Use Gravatars in Your Own Site and Software
Gravatars are becoming not just a popular addition to your website or service, but an essential part of making your users feel part of a friendly, welcoming community. You will have seen the small smiling faces around websites, blogs, communities and web service software tools.
If you are using WordPress then Gravatar support is now built in. Other software or services might be supported too. When you are developing your own software tool or service though you might feel out of luck.
Well, good news! Adding Gravatar support to your own software is easy
A gravatar is simply an image hosted centrally at Gravatar.com using the following URL structure.
http://www.gravatar.com/avatar/xxxxxxxxxxxxxx
Where xxxx would be replaced with the unique identifier for the particular users Gravatar.
How to do you discover the unique ID for a user? Simple – the key string is simply the person’s email address put through an MD5 conversion.
So my Gravatar is http://www.gravatar.com/avatar/772bb0ad28f9cdd045aca3ac25500a12 which is chris ..at.. chrisg … .com, and when used, creates the following JPG image. If you want to convert an email address to an MD5 hash, simply use this helpful web service. Enter the email address, convert it, then copy and paste the result at the end of the Gravatar URL above, replacing the unique ID with your new one.
Most programming languages have an MD5 function available, for example in PHP you would use the md5() function:
echo md5($email);
.. to output the MD5 hash of a supplied email address.
You can also optionally add a size parameter in the form ?s=300 where the size is in pixels.
Eg.
http://www.gravatar.com/avatar/772bb0ad28f9cdd045aca3ac25500a12?s=300

