What is Libravatar?

It's a piece of free software to do federated avatar hosting. What does that do and why should you care?

Say you've got a profile image you like to use when you have an account somewhere. You want this photo to show up whenever you interact socially with a website. In other words, you want your blog comments, status updates, git commits or anything else you do publicly to be associated with that image.

Uploading your image everywhere is clearly a waste of time. What if there was a place where you could put it and where every website out there could access it easily? That's the idea behind Gravatar, the service that pioneered this approach and inspired Libravatar.

How to use it

All you have to do is sign up on libravatar.org, upload your photo and tell us what your email address is. That's all.

Once you've done that, a bunch of websites (where you've entered your email address, usually as part of the registration process) will start displaying your avatar next to your name.

Freedom and federation

How is Libravatar different from Gravatar though? The main difference is that while Libravatar.org is an online avatar hosting service just like Gravatar, the software that powers the former is also available for download under a free software license.

Why would you want to run your own instance? Our belief is that centralised approaches don't put users in control. If you own your own domain name, you control how mail is delivered to your domain. You should also be able to control how avatars are served to other websites.

For example, if you own a business, you may want to integrate with existing systems (e.g. a staff directory) and delegate authentication to what you're already using (LDAP?). Plus, you can choose what happens when email addresses are not found (display your company logo?).

What else?

Libravatar also supports things like OpenID. Not only can you login without creating a username and password, but you can also assign a photo to your OpenID identifier just like you assign photos to your email addresses.

There are lots of other things in the pipeline and if you have a great idea why not tell us?

How does it work?

The basic architecture is meant to be simple and scalable:

  1. Users log into a dynamic Django-based site where they upload their photos and confirm their email or OpenID addresses.
  2. Uploaded photos are cropped, resized and optimised one after the one using Gearman to ensure that the server is not overloaded.
  3. Once the slow operations finish, the final image files are stored on disk with a filename corresponding to the email/OpenID address hashes.
  4. These photos are then replicated to all of the mirrors which serve them as static files directly to end-user browsers.

If you're interested in the details of how third-party websites display Libravatar photos, have a look at our API. The gist of it is that clients get a base URL via a DNS lookup and then tack on the hashed value of the user's email or OpenID address to form the final image:

<img src="http://cdn.libravatar.org/avatar/f52a1d3d8c39868fc92cf70828821635">

It's pretty simple, but for most web applications it's even easier because they're just using one of the convenient libraries provided by the community.