Announcing EEGravatar.

I’ve written my first plugin in PHP for ExpressionEngine called EEGravatar. It’s basically a simple way of allowing for avatars in your entries or comments using a centralized avatar hosting service called, oddly enough, Gravatar. If you’d like an avatar image of your own for the comments, just go to the Gravatar site and register using the same email address you use to post comments here and upload an avatar no bigger than 80×80 pixels. Once it’s approved it’ll start showing up in your comments automatically.

If you’d like to use EEGravatar on your own ExpressionEngine blog you can download a copy by clicking here. There is also a plugin available for MovableType and WordPress. There’s also a hack for TextPattern.

Update: I’ve duplicated the docs included in the plugin in the extended entry.

Updated Update: Here’s a little Gravatar button I made if you want to use it:

Version Update: The plugin has been updated to EE Gravatar 1.2 for use with ExpressionEngine 1.1 and is now a single tag plugin. See the updated docs in the plugin or down below for examples.

Version Update: The plugin has been updated to EE Gravatar 1.3 (the Lisa-Jill version). Minor change to output for XHTML compliance.

Version Update 10/2/04: EEGavatar is now up to version 1.4. Can now use {name} in addition to email as the one required parameter for use in Member Profiles and other places where the email parameter breaks the plugin. See documentation below for more information.

Version Update 2/19/2009: The ever talented Leevi Graham contributed an update that adds in the parameters of {logged_in_user}, 1 and raw_md5=”“. The plugin also returns the new URL format which allows for .pngs and .jpgs.


The EE Gravatar Plugin allows you to easily insert a “globally recognized avatar” image from Gravatar (

This plugin requires at a bare minimum one of two possible parameters depending on where you wish to use it. The first option is a user’s email address and the second option is a user’s screen name. The reason for this is so the plugin can be used in situations where one or the other parameter won’t return the proper result. It is recommended that you use email for comment and entry loops and name for display in member profile templates, but feel free to experiment. Here’s the two minimum required uses:

<img src="{exp:gravatar email="{email}"}" /> -- For use in comment or entry loops.

<img src="{exp:gravatar name="{name}"}" /> -- For use in templates such as Member Profiles where email won't work as expected.



Defines a default avatar if there isn’t one associated with the email address or if it exceeds the rating.

rating=”[G | PG | R | X]”

Allows you to limit gravatars to the appropriate rating. Anything exceeding the rating will use the default (if supplied) or not display.


Allows you to define how big the gravatar will be in pixels. Any size other than 80 will cause the original gravatar image to be downsampled using bicubic resampling before output

border=”[hex color]”

Puts a border of the specified color around the gravatar.


Here’s a few examples that you might use:

<img src="{exp:gravatar email="{email}" rating="PG"}" />

Only displays gravatars of PG rating or lower.

<img src="{exp:gravatar email="{email}" rating="R" size="40" border="FF0000"}" />

Displays 40×40 pixel gravatars of R rating or lower with a red border around them.

<img src="{exp:gravatar email="{email}" size="70" default=""}" alt="Picture of {name}" title="{name}" class="avatar" />

Displays gravatars of 70×70 pixels or a default graphic for users without a gravatar. Puts the user’s name in the alt and title tags and styles the image using a class called “avatar.”

<div class='profileTitle'><img src="{exp:gravatar name="{name}" size="80" rating="R"}" border="0" style="float: left; margin: 0; padding: 6px;" alt="{name} pic" title="{name}" />{name}</div>
p>{lang:member_group}&nbsp; <b>{member_group}</b></p>

The above is a snippet of code from my Public Member Profile template showing how to insert a gravatar into the member listings for your site.

== Change Log ==

V1.5 – Added {logged_in_user} and 1 parameter as alternate to & {name} for times when you just want to show the logged in users gravatar.
    – Added raw_md5=”” parameter to return the raw md5 encoded version of the email and not the whole gravatar url.

V1.4 – Added {name} parameter as alternate to for use in situations where breaks the plugin such as Member Profiles.

V1.3 – Changed & to & for XHTML validation compliance.

v1.2 – Made into a parameter along for single tag usage for EE 1.1 release.

v1.1 – Minor bug fix.

v1.0 – Initial Release

87 thoughts on “Announcing EEGravatar.

  1. Thanks for the nifty tool. I’ve put it on my site, but I don’t know that I get the population of geeky computer nerds who would trouble themselves to register with gravatar.

  2. Look at it this way: Even if no one who visits your site regularly bothers to sign up you’ll still see mine if I should happen by. grin

  3. Cheers for the update Les… As always its sweet… Makes the “hack” a little easier to remember now wink

  4. Hi
    I have a gravatar and now i want to install that plugin in my wordpress blog. But where should i put: this???  Should i put that in my comments.php? And where exactly in comments.php? Or am i wrong???

    The plugin is active in wordpress and i tried to comment my own post but no gravatar shows up.


  5. Shouldnt my gravatar show up here in this comment? I know the gravatar works ‘cause i saw it on another blog when i comment…

  6. Martin, EEGravatar is a plugin for users of ExpressionEngine and it won’t work in your WordPress blog. Instead you should make use of the WordPress Gravatar Plugin. The instructions on how to use it with WordPress are included at that link I provided.

    If you have a working Gravatar then it should be showing up here, though I must admit that I’ve stopped development of EEGravatar now that ExpressionEngine has a built-in Avatar function. It’s possible my plugin isn’t working correctly at the moment and I’ve just not noticed.

  7. Misu, I’ll be honest and admit that I’ve not kept up with Gravatar since EE added Avatar support right in the program. I still have my plugin running on this site, though, and it still appears to be working for the moment.

    I’ll check out what’s new with Gravatar and if any changes are needed to the plugin then I’ll see if I can’t hack something together.

  8. Gravatar changed the way how to receive paramets, now size is only “s”, more:

    so, this plugin is working, but it’s not sendind default and size paramets, I hardcoded my size and default image, so now is working, but sending directly from EE template is not workin, I have version 1.6.1

    beside, great work!!

  9. Davor, thanks for the heads up on the change. I’ll modify the plugin and get a new version out. I’ve not messed with it in awhile seeing as EE now supports native avatars, but I’ll be sure to get this change worked in as soon as I can.

  10. Great.. usually I dont like to change originally made code, even is very easy to do it, most for the right of the author,, so.. when you make new version,, post a comment to notify all users 😀

    thanx Les

  11. I haven’t had a chance to work on it yet as I just started a new job, but I should be able to get to it within the next day or so. I’ll post an announcement here when it’s done.

  12. I just implemented this plugin into the redesign of my blog. One of the blogs I read has a checkbox at the bottom of the comment form “sign me up for a free gravatar” link. Is this something the plug in can do?

  13. Not at this time. I’m not entirely sure if that’s a function of the WordPress plugin that blogger is using or if it’s a custom script he came up with himself. I’m guessing it’s the latter, but you’d probably do better to write him and ask how he manages it.

  14. Les,
    I found out that there is a gravatar sign up plugin for wordpress.

    I would love to port this to EE but since I no next to zero about php, that’s not really possible. Anyhow, if you have time and are inclined to do this I would be very grateful.

    If you don’t have time, I understand and thank you for having already created the excellent EE gravatar plugin.

  15. EFL, I’ll take a look at it and see what I can do. I still need to find the time to update the current plugin to use the new parameters. Was hoping to have that done by now so no promises as life is a bit hectic at the moment.

  16. Does the plugin work in EE’s discussion forum module? I know that the forum module has built-in support for its own avatars, but my bandwidth usage is getting pretty high, so I’d prefer not to host people’s avatars on my server.

  17. Alex, not sure if it’ll work in the forums or not. I’ve not tried putting it into the templates, but give it a shot and see what happens.

    Alkel, you’re email isn’t all over the post. EE is just interpreting a variable it shouldn’t in the example. Everyone who looks at this page sees their own email address listed so the only person seeing it is you.

  18. Hi Les,

    After some experimenting, I’ve found out that it does work in the forum module. The only trick is that you have to run the forums through the templates. This means that the url of my forums changes slightly. But otherwise it’s a seamless transition.

  19. Just a small note to let folks know that version 1.5 of the plugin has just been uploaded. This includes changes made by Leevi Graham to add new parameters and update the URL returned to the new format. See the changelog for details.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.