Marco's Blog

All content personal opinions or work.
en eo

How do I get my gravatar.com URL

2008-01-25 2 min read Howto marco

This is a really easy one, but since I had to crawl across the gravatar site to find out how to do it, here is a quick introduction to get the URL for your gravatar. No thrills and frills, but it does what most of us will need.

First, you need to create a gravatar account, if you don’t already have one. Gravatar is a site that aggregates avatar images for the different social networking sites (like Facebook, MySpace, etc.) and blogs (like Blogger). It works by storing an image of you (of your choice) and associating it with your email address.

Once you are in a piece of software, so the thinking goes, instead of uploading for the umpteenth time your avatar image, you just use a gravatar plugin, enter the email address, and off you go with the same avatar you have used on all other sites.

If you want to use your (gr)avatar outside of the software mentioned above, there is a handy URL you need to enter. Creating the URL is what I’ll discuss here.

First, there is a constant portion and a variable portion. The setup is such that the variable portion is sent as URL arguments, so it’s not too cryptic. There are a few arguments of interest, the most important of whom undoubtedly are:

  1. gravatar_id (mandatory): the MD5 checksum of the email address you used
  2. size (optional): size in pixels of the avatar image. The size can be up to 80, and if it’s smaller than that, then bicubic zirconium is used to shrink it (haha).

The constant part of the URL is just constant: http://www.gravatar.com/avatar.php. It looks like it works fine without www, which shaves four characters off the URL, but you can’t really rely on that.

To generate the MD5 sum, you either use Linux, or you go to an online MD5 checksum-generator. In the former case, if your email address is ’email@address.gov’, you type:

echo -n email@address.gov | md5sum

The garbage that comes back is your MD5 checksum (in this case, 188753ba98efb8a2d142455db2ede038). So, now your full URL for a 32 pixel avatar is:

http://gravatar.com/avatar.php?gravatar_id=188753ba98efb8a2d142455db2ede038&size=32