How do I manually display an avatar that is different from either of the preset sizes defined in the user settings?
j0k3z - April 9, 2008 - 20:17
| Project: | ImageCache Profiles |
| Version: | 5.x-1.4 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I want all user avatars to default to 100x100 when I havent declared them to be any other size. I also want the profile picture to be 200x200. I was able to set this up perfectly using the settings provided in the module.
The problem is when I wish to display an avatar in a block on another page, I tried using the following php code but it still shows the image at the default 100x100 size. What can I do?
theme('user_picture', $user, 'avatar-l')

#1
Call
theme('imagecache', $ruleset_namespace, $image['filepath'], $alt, $title, $attributes)$ruleset_namespace is an imagecache preset name you have defined.
#2
This is really old, but anyway.
I have a "dashboard" created with panels. one of the blocks shows the user picture of the current user. I have 3 imagecache presets:
1. one for comments: userthumb
2. another one really small: usersmall
3. and another one of the size of my block, this is the big one: user280x
To show the block with the preset I want I'm using this code:
<?phpglobal $user;
if ($user->picture) {
$size = user280x;
$picture = theme('imagecache', $size, $user->picture);
echo $picture;
}
else {
return '<strong>' . t('You do not have a User Picture.') . '<br>' . '<br>' . '<a href="user/'. $user->uid . '/edit">' . t('You can upload one here.') .'</a>' . '</strong>';
}
?>
The "if" is just to show a message if the user hasn't uploaded a picture. You can use a default picture or whatever you want.
I'm changing to support request because this is not a bug, and I'm also using the latest version. Haven't tried with 1.3
Luis