I'm looking at putting together a Drupal 7 installation for a community website. One of the features of the website will actually be in specific user profiles, which will double as "About" pages in a catalogue of team members. Anyway, the site is currently designed in such a way that a user has a detailed photo on their page. I'm looking at one of two different options, and would like some input as to how best to carry out this task.

  1. After a user uploads a profile picture (with the ImageStyle profile_picture) , have the system create a duplicate photo for the forum avatar based on what was just uploaded, only resize and crop the photo to be 200x200 pixels, and have the duplicate be named under the image style forum_avatar.

  2. Provide an additional upload form for avatars in the user configuration settings with Drupal 7.

Obviously, the first one would take a little bit of doing, but I'm really curious: what would be the best way to carry out one of these two processes?

1 Answer 1


Assuming that you want to use the same avatar image, just in different sizes, you do not have to duplicate anything.

Being able to display the same image with different styles is the whole point of having different image styles. "Styled" images are created on demand, according to the request. This already works out of the box for normal image files (For example, you can chose a different image style for teaser and default view modes).

The user avatar image can be displayed with different image styles too, the only problem right now is that you can't select the image style when using theme_user_picture(). There is however already a patch for that. And if you're using Views, it should already be possible to choose the image style for the user picture.

  • Hey, great! I'll give those things a try. I think I'll try doing it with Views first. I'm still trying to get the hang of Views, so I'm going to have to read up on some of the documentation to try it out.
    – John Riley
    Apr 30, 2011 at 19:44
  • So, I'm still confused...how do I apply the patch?
    – John Riley
    May 5, 2011 at 4:28
  • drupal.org/patch/apply has some information about applying patches. You should however only apply patches to test them in most cases, and not to use them on production sites, because you will always have to re-apply those patches until they are commited. As an alternative, you write a custom function similar to api.drupal.org/api/drupal/modules--user--user.module/function/…, that calls theme_image() directly with the desired image style.
    – Berdir
    May 5, 2011 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.