By Tim99 on
Hello,
I wonder how to access the user->picture inside a comment.tpl.php. I want to drop the theme function and use imagecache instead. But I don't know which variables to put in. $picture delivers a picture surrounded by HTML.
$avatar = $user->picture;
print theme('imagecache', 'width41', $avatar, 'User Pic', 'Title', null);
This leads to ...nothing. No picture is shown. Any ideas?
Comments
$picture variable
I believe that the user's picture is used by the variable $picture. There's a helpful tutorial about comment theming here:
http://www.alldrupalthemes.com/blog/theming-drupal-comments-exemplifying...
-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com
Also really interested in an answer
And I haven't found anything in the API documentation that suggests we can get anything other than $picture in comments.tpl.php. I hope I'm wrong.
See http://drupal.org/node/11815
Replace all instances of
Replace all instances of $picture with $comment->picture
in the file comment.tpl.php in path/to/your/theme
To see what is available inside the $comment Array, type the following:
also, in the file comment.tpl.php
Go Themes/your
Go Themes/your theme/configure and enable the display of use pictures in comments
ImageCache Profile
While all the comments above are useful, they are not directly related to the issue of using ImageCache with user profile pictures.
The module you're searching for is ImageCache Profiles. It handles all user images for profiles, comments and posts.
User profiles are not nodes, so you need this module in order to assign an ImageCache preset to the profile images.
Read the module README.txt carefully as I think you need to follow a specific ImageCache preset naming procedure in order to get it to work.