The power of Globally Recognized Avatar (aka Gravatar)

Gravatar has a very sleak concept but not many people know and understand it. It is one place for your display pictures and you can use the same at any Gravatar enabled website / application. Gravatar is currently used in WordPress, Movable Type, Drupal, Joomla and Mac OS X Addressbook.

Advantages are mainly on the user end where he/she can change one photo and reflect it in multiple places. It includes support for content-rating etc.

Here, I will show how it is implemented in PHP

$email = "my-email@hotmail.com";
$default = "http://www.somewhere.com/homestar.jpg";
$size = 100;

$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($email)).
			"&default=".urlencode($default).
			"&size=".$size;

Now use it in your HTML as

<img src="<?php echo $grav_url; ?/>" width="< ?php echo $size; ?>" alt="Gravatar" />

Simple!!

More info at the URLs below

2 thoughts on “The power of Globally Recognized Avatar (aka Gravatar)

Leave a Reply

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