I'm working on a website to be ready for Drupal 7 upon final release, and stumped on something. I'm doing theming on the comment.tpl.php file, and specifically need the file path of the user/author's picture on their comment to do some advanced theming (the $picture variable prints out a bunch of unnecessary HTML, so can't use it).
I followed this tutorial http://www.zites.net/en/drupal-7-theming-and-image-path to learn how to pull the path in D7. When I print_r on the $node variable and get...
stdClass Object
(
[field_thumbnail] => Array
(
[und] => Array
(
[0] => Array
(
[uri] => public://thumbnail/my_image.jpg
)
)
)
===============
<?php
$path = image_style_url('thumbnail', $node->field_thumbnail['und'][0]['uri']);
print $path;
?>
Sure enough, using the PHP code above returns that filepath just fine, according to tutorial. However, I then try the same code on $comment...
stdClass Object
(
[picture] => stdClass Object
(
[uri] => public://pictures/author_image.jpg
)
=========================
<?php
$path = image_style_url('thumbnail', $comment->picture['uri']);
print $path;
?>