Posts

Showing posts with the label gravatar

How to build a url of a GRAVATAR image from a given email

How to build a url of a GRAVATAR image from a given email There is a simple way with php , a simple script or URL manipulation to build a URL for the gravatar image corresponding to an email? Ex. http://gravatar.com/avatars/avatar.php?email=myemail@myserver.com and this return a jpeg or png image. Ex. http://gravatar.com/avatars/avatar.php?email=myemail@myserver.com If there is no simple way like the example, what is the easiest way you know to resolve a url of the gravatar corresponding to an email?. Thanks 5 Answers 5 You can find a sample script with PHP code on their implementation site: http://en.gravatar.com/site/implement/php Use this: $userMail = whatever_to_get_the_email; $imageWidth = '150'; //The image size $imgUrl = 'http://www.gravatar.com/avatar/'.md5($userMail).'fs='.$imageWidth; There's an error in the url, before md5 of user ...