Gravatars problem

Posted Dec 01, 2006 in PHP, si-blog.

I've been a big fan of Globally Recognized Avatars (Gravatars) for use in blog comments. Recently, however, the Gravatar website has been very sluggish. Retrieving gravatars has been a hit and miss affair. I decided to try and code around it by using cURL.

Update: The solution was bollocks, so I removed it. Like an idiot, I had completely forgotten about the implications of setting a fat timeout. I'll post a new solution in the near future.


  1. Gravatar

    I admit I'm not proficient in javascript, but I wonder if your new code is delaying the rendering of the entire page until the gravatar timeout happens.

    Previously I would get a broken image, but now the page hangs for about 10 seconds before rendering with generic gravatars.

    Posted by Stephen Collins on Dec 01, 2006.

  2. Gravatar


    I'd cache the results.

    I had a similar problem the the flickr badge generation taking absolutely ages. I now grab the script on the server, tidy it up so that it generates valid XHTML then store in the server cache with an expiration time of 24 hours.


    What happens, you ask, if I want to update the badge if I've added new pictures, for example. Easy. If a query string entry of 'clearcache' is found, the cached badge is automatically regenerated.

    Jingle jangle.


    Posted by Paul on Dec 02, 2006.

  3. Gravatar

    You are both right. This technique is delaying the page rendering. It's all done in PHP, so there is no JavaScript to worry about. I'm going to have to give this some more thought, but in the meantime I'm going to set the timeout to 1 second.

    Posted by Simon Jessey on Dec 02, 2006.