I'd like to make my Drupal installation to display userpics of different sizes for different users in the comments section. For example, I'd like to make pictures of the node author bigger than pictures of other commentators.

I have two different presets in ImageCache Profiles and one of them is used for all the userpics in comments. Now to make some of the userpics outstanding we can use their uids. I can't figure out how having uid (comment->cid) we can derive $account, since theme('user_picture', $account) requires account.

theme('user_picture', $comment->cid) or theme('user_picture', $author) did not work for me.

Comments

yngens’s picture

$comment->cid above should read as $comment->uid. pardon.

There is another approach to solve this problem. Having $comment->uid at hand, I can put direct link to userpic of needed imagecache preset whenever node author's comment appears:

<?php print '<img src="http://mysite.com/files/imagecache/bigger_user_pic/pictures/picture-'.$comment->uid.'.jpg></img>'; ?>  

However, this is not so Drupalish way, which I would like to maintain, and there appears second problem with image extensions as they are not all of .jpg type, could be .gif, .png and of other extensions. There is, of course, a feature in imagecache module to preliminarily turn all the images to certain extension. But going this way feels will be too much expensive, when I believe there is much more easier and, what is the most important, Drupalish way of displaying userpics of different sizes in comment.tpl.php.

andypost’s picture

Status: Active » Fixed

Take a look at template_preprocess_comment()

use theme('user_picture', $comment)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.