Dougal Campbell's geek ramblings

WordPress, web development, and world domination.


Even before the recent announcement about Gravatar joining Automattic, I had been wanting to turn on comment avatars here. I nabbed Matt’s code, fooled with it a little, and now my comments are Gravatar enabled.

A couple of things that I discovered:

  • I was always getting the ‘default‘ image until I added a ‘rating‘ parameter.
  • The Gravatar server wasn’t serving up all sizes of my image until I re-uploaded it. It worked with size=40 and size=80, but not with size=60

When I did a quick search for an existing WordPress plugin, the Gravatar plugins I found all required you to modify your comments.php template file. I made mine less intrusive. I think I’ll go ahead and code up a plugin with some config options.

About Dougal Campbell

Dougal is a web developer, and a "Developer Emeritus" for the WordPress platform. When he's not coding PHP, Perl, CSS, JavaScript, or whatnot, he spends time with his wife, three children, a dog, and a cat in their Atlanta area home.
This entry was posted in Blogging, WordPress and tagged , , , , , , , , , , , , . Bookmark the permalink.

39 Responses to Gravatars

  1. Futura says:

    I got Gravatar enabled too πŸ™‚
    Not that I get that many comments, but its a nice thing to have.
    I used the plugin they offer on the gravatar website.

  2. mcangeli says:

    I’ve had gravatars enabled for a while. I’m using the Gravatars2 plugin. Works well. I just have to add a default one…

  3. GreyDuck says:

    I added Matt’s code and it seems to work without any modification on my end. That’s not to say I’d mind a nice configurable plugin, tho’. Hmm!

  4. Sarah says:

    Mine keeps getting resized (on my own blog), but I don’t know enough about code to fiddle with it. I wish all of them would be 100×100, just because I like that size, πŸ™‚

  5. Joana says:

    I’ve been sorely tempted to join the gravatar-enabled wave, but I really don’t like having to fiddle with my comments.php for fear I break something and all of the plugins I’ve seen require quite a bit of editing, and not just on one page. A plugin with config options would be most appreciated. πŸ˜€

  6. sk says:

    I only wish it would work so that it would choose between a favicon from the URL the person provides or the gravatar. Anyone have any php code for hte server to automatically toggle between the two?

  7. Jaypee says:

    I used to use the Gravatar plugin on my blog but switched to the MyAvatars plugin after I joined MyBlogLog because not all people have Gravatar accounts.

    Anyways, a plugin with config options would be nice. πŸ™‚

  8. Dougal,

    Me, too. I added Matt’s code to my comments, but a plugin is nice for those not wanting to play around with the code. Go for it.


  9. ajua says:

    i have my site gravatar-enabled but i got my theme to use image sizes of 25×25 and im getting only the default “G” image. i hope they correct this soon…

  10. S.K says:

    I am unable to get Gravatar to work in my blog since my theme’s comments template doesn’t have a “list” element, but a div element to display the comments.

    Anyway, except in a few of my posts there is not much of comment activity over there either!


  11. Douglas Karr says:

    S.K. – you don’t need to use a list element. I use a div element on my blog. I simply put the image just inside the div and align it to the right with enough padding or margin so nothing writes over it. Here’s how:

  12. Zeo says:

    I code this gravatar plugin not long ago. But it got few issue with recent comment. No need to modify your comment template but need to add a default image.

  13. Al says:


    Scott Yang wrote a great plugin named Gravatar Cache, it might be worth checking out as well.


  14. Ilias says:

    I ‘ve been using gravatars for a while on my blog.. Great Add !

  15. Yep, just enabled Gravatar’s on my site. Seems like everyone is doing it now…

  16. Jeffro2pt0 says:

    I use a plugin that displays both Gravatar and MyBlogLog avatars. I explained which one I use and how to install it here

  17. Patti says:

    I’m looking forward to it. I tried modifying comments.php, with no luck. I will now patiently wait till you’re done coding. πŸ™‚

  18. Kirk M says:

    I’m also looking forward to whatever you can put together. I’m finding myself getting too old(er) to wrap my head around code any longer. Always gave me a headache anyway. πŸ˜›

  19. FrankPereiro says:

    Thanks for this. I will be using this feature in my blog.

  20. Silveira says:

    I’m already using gravatar in my blog.

  21. Sabo says:

    Someone went ahead and created a Plugin already using new Matt’s code:


  22. Melissa says:

    I used to use Gravatar all the time..until it exploded all over the internet. I think I’ll switch back to using it again!

  23. S.K says:

    Thank you Mr. Douglas Karr.

    I’ll also await Dougal’s promised plugin!

    But why my avatar is not showing up here? (I am a member in Gravatar)


  24. I just cropped my head in half darnit. πŸ˜‰

  25. Stephen Chu says:

    Another vote for Gravatars2. The option to have local avatars is great.

  26. Pingback: Ya no hay excusas para no usar Gravatar » Blogueando con Francesc Josep

  27. chikuten says:

    gravatar testing

  28. Ron says:

    Funny thing I can’t show up any gravatars on my site… Instead the plugin I used only shows up avatars from myblogblog…

  29. Bryan Price says:

    That explains why some of the sites I’ve been at recently aren’t showing my gravatar. And here I thought I was using the wrong email address. I’ve added all of my emails. I guess I’ll see mine now. πŸ™‚

    Hmmmm. No avatar for me!

  30. Bryan Price says:

    Haha. I still have no gravatar. There’s a link where it should be, but no picture. Weird.

  31. Pingback: Stack Overflows Under Control »

  32. Bryan Price says:

    The Gravatar server wasn’t serving up all sizes of my image until I re-uploaded it. It worked with size=40 and size=80, but not with size=60

    S.K., that’s probably the reason why we can’t see our gravatars. We need to reupload them because Dougal is using the 60×60 size.

    Of course, I just changed it, and I’m still not showing up. That might be a gravatar caching kind of thing too. Weird.

  33. Bryan Price says:

    My gravatar is working. Yeah! So yes, I had to reload it, and then it may have had to go through a human looking at it to make sure it was rated G. Or maybe it truly is a caching issue.

    A nice feature would be allowing a separate avatar for rating of each email.

  34. Bryan Price says:

    In pointing to somebody else to this discussion, the page is taking about a minute to load. I have a feeling that is due to the gravatars. πŸ™ You might want to time things on your end Dougal, because while they may look pretty, the wait for the results may be too much.

  35. Dougal says:

    I don’t think it’s the Gravatars. It’s my wimpy web server. I’m shopping around for a new host. I’ve had free web hosting on this server for quite a while now, but often you get what you pay for πŸ˜‰

  36. John Yellow says:

    I’ve implemented gravatars on my own blog recently and everything seems to work smoothly. Really great plugin!

  37. Mares says:

    Joined and will download the plugin to try it out on my blog.

  38. Sujan P says:

    Gravatars are global recognizable avatars, a hosted avatar service for profile pictures, usually used to pimp comment sections on blogs, but also on forums, author pages, and whatnot.

Leave a Reply

%d bloggers like this: