Provide a theme function to get different sized gravatar
budda - December 10, 2008 - 00:09
| Project: | Gravatar integration |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
In my theme i'd like to display a larger version of the users Gravatar. Currently there is no simple function to call, pass in a user object and a size, 80x80 for example, and return some HTML markup which can be pasted in to the tpl file.
The code in gravatar_preprocess_user_picture() could do with breaking up in to reusable bits maybe?

#1
As an alternative for now, you could run the following code:
<?phpvariable_set('gravatar_size', 100);
?>
#2
I considered that, but would it not cause a possible display of the smaller regular Gravatar to appear larger elsewhere on the site if another user was also displaying a page containing Gravatars somewhere?
For now i have hard-coded a custom url direct to Gravatar in template.php
#3
I'm not sure that gravatar_preprocess_user_picture can really be split up, since it's simply an over-ride for template_preprocess_user_picture and needs to accept the same arguments. Can you give me an example of the function you'd like to be able to call in your template?
#4
I rewrote _gravatar_get_gravatar recently to accept an array of parameters, so it could be reused if you want to use it. For example:
<?phpecho '<img src="'. _gravatar_get_gravatar(array('mail' => $user->mail, 'size' => 100)) .'" />';
?>
#5
#6
Automatically closed -- issue fixed for 2 weeks with no activity.