Gravatar is globally recognized avatar, a free display picture service, by Automattic. As Gravatar is accepted everywhere on internet, it is recommended that one theme developer should use Gravatar in his theme.
For a new developer fetching Gravatar may seem a little difficult. I thought to provide complete code that you can use directly wherever you want.
Explanation:
Gravatar is based on user email ids. Each email is a different Gravatar. The fetching requires md5 hash of email id of a user. Please note that you need to change $email, in below code, for every user.
$default = “”; // link to your default avatar
$email=abc@example.com
$size = 32; // size in pixels squared
$grav_url = “http://www.gravatar.com/avatar.php?gravatar_id=
” . md5($email) . “&default=” . urlencode($default) . “&size=” . $size;
?>
<img src=”<?=$grav_url ?>” height=”<?=$size ?>” width=”<?=$size ?>” alt=”User Gravatar” />
$grav_url is image link.