Implementing gravatars with PHP is quite simple. PHP provides both md5() and urlencode() functions, allowing us to create the gravatar URL with ease. Assume the following data:
$email = "someone@somewhere.com";
$default = "http://www.somewhere.com/homestar.jpg";
$size = 40;
You can construct your gravatar url with the following php code:
$grav_url = "http://www.gravatar.com/avatar.php?
gravatar_id=".md5($email).
"&default=".urlencode($default).
"&size=".$size;
Once the gravatar URL is created, you can output it whenever you please: