You probably know Gravatar, the (proprietary) service by the Wordpress.com guys. You give it the md5 hash of an email address and get an image for it - given that the person owning the email address registered there and uploaded a picture.
Many many blog and web applications use those images to give comments a personal note and make it easy to recognize the commenters.
Libravatar (libre avatar) does basically the same, but has some huge benefits:
- It is federated, which means that you can host your own avatar server for your domains. In case Libravatar.org or Gravatar are down, images for your email addresses will still be delivered.
- You can use it as a service like Gravatar if you don't want to host your own server. But unlike Gravatar - which you cannot leave - you have full control over your avatars and your account. Full account export and removal are supported.
- You can assign images to OpenIDs.
- It is open source. The Libravatar sources are open for anyone to inspect, improve and install on your own server.
- It falls back to Gravatar. The userbase of Gravatar is not to be neglected, so Libravatar falls back to the Gravatar image if there is no Libravatar one.
- You do not have to register another account but may login with your OpenID.
The original Libravatar software is written in Python and contains the whole package: Profiles, login, image upload, email and OpenID management.
I do not need all that; all I want is to put an image file email@example.com somewhere, and that's it. This is Surrogator.
$ pear install services_libravatar-alpha
Using it is as easy as writing four lines of code:
<?php require_once 'Services/Libravatar.php'; $sla = new Services_Libravatar(); $imgUrl = $sla->getUrl('firstname.lastname@example.org'); echo '<img alt="Avatar" src="' . htmlspecialchars($imgUrl) . '"/>';
That's it. Now start using free avatar images in your software, and use one of the available plugins.