This morning I added Gravatars to the comments here. If you don't have a Gravatar, you can go create one at the Gravatar site.
Adding Gravatars to a site is fairly simple to do - it's just a matter of doing an MD5 hash on the email supplied in the comment form. The Gravatar site has sample code and plugins etc. exist for common platforms.
Your email is never displayed but it might someday be possible to reverse engineer it from the hash (see Wikipedia MD5). If that concerns you, either do not use Gravatars or use an email that doesn't matter for this (see examples in the comments).
The Gravatar site has more explanation in its FAQ
Simple command line code to do this is:
#!/usr/bin/perl use Digest::MD5 qw(md5_hex); $data=<>; chomp $data; $digest = md5_hex($data); print " $data = http://www.gravatar.com/avatar.php?gravatar_id=$digest\n";
Obviously squeezing that into my comments code took a little more work, but I think it is all set now. Older comments won't show gravatars - only comments you add now that include an email address.
If you found something useful today, please consider a small donation.
Got something to add? Send me email.
More Articles by Anthony Lawrence © 2009-11-07 Anthony Lawrence