Let me start by saying that I love Gravatar.com–most of the time. They do one thing very well: Serving up an avatar based on an email address.
(skip below if you are just interested in why they FAIL)
How Gravatar Works
Anyone can sign up on Gravatar, upload images, crop them and associate them to 1 or more email addresses, which can then be accessed by 3rd party sites using a simple to generate URL:
<img src="
http://gravatar.com/avatar.php?
gravatar_id=f83d1b99858682d4d567e8bf400a55b8
&rating=PG
&size=40
&default=identicon
"/> |
Where f83d1b99858682d4d567e8bf400a55b8 is an md5() hash of my email address.
This outputs , and if it couldn’t find my email address, it would have output
(since I specified ‘identicon’ as the default image if one could not be found). I could also have supplied a full URL to a default image of my own.
Basic Implementation in PHP
<?php /** * Gravatar * Fetches a gravatar from the Gravatar website using the specified params * @access public * @param string $email The email address of the avatar to fetch * @param string $rating Defines a maximum rating for the image’s content. If the owner has flagged the image with a rating higher than that specified, the default image will instead be used. Acceptable values are G, PG, R, or X. * @param integer $size Defines the desired height and width of the image in pixels, with acceptable values being between 1 and 80. Specifying a size smaller than 80 will result in the original gravatar image to be downsampled using bicubic resampling before output. * @param string $default The default parameter allows you to specify the URL to an image that will be used as the default if the query fails to locate a gravatar for the given email address. Additionally, if a user’s gravatar exceeds the rating limit defined by the “rating†parameter, this is the image that will instead be shown. $default can also be 'identicon', 'monsterid', or 'wavatar' * @return string */ function gravatar( $email, $rating = 'X', $size = '80', $default = 'identicon' ) { return "http://gravatar.com/avatar.php?gravatar_id=" .md5( strtolower($email) )."&rating=" .$rating."&size=" .$size."&default=" .urlencode($default); } ?> |
Easily called as so:
<img src="<?=gravatar('email@domain.com')?>" alt="avatar" /> |
How Does it FAIL?
I’m a Web Developer. I make websites–mostly social websites. It is imperative for these sites that users have a personal avatar. If they don’t, we provide a default dummy image and give them an opportunity to override it by uploading one of their own. This is VERY common on the web. Look at Twitter (they don’t use Gravatar). Every site with a profile allows users to upload an avatar.
Here’s the crux of the problem: None of these sites are going to tell their users to go create an account at Gravatar.com to upload an avatar. That’s just absurd. Why tell your users to leave the site if you don’t have to? If it’s easy enough to build your own solution without having to have your users go elsewhere to get the job done, companies will always roll their own avatar upload/crop/management system.
This is… stupid.
This is not what the dream calls for.
The Solution
Gravatar could (fairly) easily develop a developer system that allows 3rd party sites to use an embedded form of Gravatars upload/crop system to add images for email addresses that don’t have a Gravatar account. Hey, they are already doing this on WordPress.com! There are gobs of ways to do this. If they want to hire me, I’ll gladly build it for them. I’m sick of having to implement avatar upload/crop and management systems on my own–and it sucks to be able to use Gravatar only until they don’t have an email on file, at which point we have to have the user store an avatar on our servers–then the user goes to another site and they have to do it again–all because we will never tell them to create a gravatar account and gravatar will not allow us to upload an avatar for the user.