Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Just love your module, thank you.
Please, as the output of the user picture is rather large and would prefer my imagecache preset 'imagecache/profile_small' to show in latest visitors, how would I change ...
$output .= theme('user_picture', $account);
to show the small picture I've setup in imagecache.
I found a possible solution, but don't know how to implement it at: http://drupal.org/node/284364
Most appreciate and reply, and thank you.
Lilian
Comments
Comment #1
Witch CreditAttribution: Witch commentedyep, that would be great!
*subscribe*
Comment #2
sanduhrsThat seems more like an issue for ImageCache project, so moving.
I think your question is answered in the docs [1].
So, replacing
$output .= theme('user_picture', $account);
with something like
$output .= theme('imagecache', 'YOUR_PREVIOUSLY_CREATED_PRESET', $account->picture, $alt, $title, $attributes);
should do the trick (untested).
vg
[1] http://drupal.org/node/163561
Comment #3
drewish CreditAttribution: drewish commentedthat looks right to me.
Comment #5
jwilson3The problem with the example in #2 is that if the user doesn't have an uploaded picture. It doesnt know where to get the default picture.
I assume you're using imagecache_profiles for user pictures. If not, then first and foremost, you should install imagecache_profiles , as it is built to handle this specific case.
Imagecache_Profiles module allows you to have three presets assigned for viewing profile images, but if you need to specify by hand in a template file or elsewhere... then, there are two ways to possibly handle it:
1) Use logic to set the default image if the profile has no image set:
2) specify the imagecache_preset before calling user_picture. My preferred way (much less code, and logic).
Comment #6
jrivelli CreditAttribution: jrivelli commentedI did
and it is displaying the text 'profile_picture' only. I obviously messed it up, what do I have out of order here?
Comment #7
jwilson3@jrivelli. Two issues: You're printing the wrong statement, and this whole post from the OP down to here assumes $output .= line is located inside a function that actually returns the $output variable. If you wanted to print this directly to the screen, say in a template file, it would look like this:
Comment #8
jrivelli CreditAttribution: jrivelli commentedSweet, thanks a ton man!
Comment #9
yngens CreditAttribution: yngens commentedI am trying to output userpics of the node author of different size in the comments. We have $author and $comment->uid available in comment.tpl.php, but not $account. Can't figure out how to use
in comment.tpl.php.
Comment #10
jwilson3@yngens: Try using imagecache_profiles module, and configure it with the desired imagecache preset in the user settings administration page.
Then the $picture variable (avaliable in comment.tpl.php) will hold the correct image.
Comment #11
Berliner-dupe CreditAttribution: Berliner-dupe commentedHello,
can anyone help me plz - i dont understand this?
I have 3 Roles (girls, boys, groups) - every role must have a "default image" if the user dont uploaded an own user-picture.
Now i found in other thread the information that i must use theme_preprocess_user_picture for this.
I copy the code for this function from user.module to my template.php
But now the imagecache-presets from imagecache-profile will ignored for users with own user-picture. All picture on my sites (different views with different imagecahce-presets) use the original-size for this file now.
The second question is - how can i set the default picture when users dont upload own picture?
I checked
but this dont work. Other problem will be - if it work - i think the imagecache-presets for this default-image will be ignored too or?
Can anyone help me plz - i have big understand-problems for this.
(Sorry for my bad english)
Regards Matthias
Comment #12
fizk CreditAttribution: fizk commentedPlease reopen if this is still an issue with ImageCache 6.x-2.0-rc1.