One avatar to rule them all
![]() |
Image from Pexels |
Avatars are really personal most of the times. It shows ourselves or how we would like to be shown on the web. Can be a simple photo, an artistic photo, a combination of a person and a place, an icon or any other image that we identify ourselves with. It's an expression of our personality in a single image and our visual identification.
When the web was giving its first steps, sites were simple. Many of them didn't required logins, and profiles weren't that important. Today however, it's pretty sure any site you register with will have a profile in where you put things about yourself, including your image. This happens mostly because the web is now way more social than it was before. So any account you create somewhere it's likely to have this space for you, whether it's a simple image and some text or complex enough to dump your entire life there. A Facebook profile for example overflows with information about someone, provided that someone allows it, a GitHub profile in constrast is more simple. While both serve different purposes, both have an avatar.
If you browse the web a lot and use a lot of services from the internet, whatever it might be, you end up with accounts all over the place, probably created with a single email. This means you have several profiles out there you might want to keep up to date.
The use of OAuth nowdays helped concentrate registering on other sites using a safe approach and removing the need of credentials, linking a main account to these services. This is one way to mitigate credential usage, because let's be honest, handling a lot of them is difficult.
I'm not going to talk about privacy stuff regarding what you publish, it's enough to say that one needs to be careful, and it's a whole other topic to treat on another post. What I would like to talk about is Gravatar and what it does.
Maybe you knew about, if you do and use it, awesome. If you don't keep reading.
Gravatar is a very simple API that hosts small images used for avatars. It's not quite popular I think, but a few sites use it, GitHub is among those. The images are stored in different sizes and can be queried from anywhere, since it's public. Given an email address it hashes the text to create a uniq identifier for that email and links it to an image. Then, any other site or person can query the API for a hash and it will return an image uploaded by someone or a default image if none exists.
And what might that be useful for? Well, if many of the sites you have an account with use gravatar or allows you to put an avatar URL instead of uploading a file, the effect is that when you change that image, all other sites using it get updated instantly. Pretty handy. A use case could be an image that gets identified as copyrigthed, and you suddenly realize you uploaded that image to dozens of sites for your profile's avatar. If you need to take it down you would have to login and update the profile dozens of times. Gravatar can mitigate that quite a lot. Your avatar becomes a public image available to anyone that is not tied to a single resource upload.
If you are hax0r, you can direclty query the API with curl or some other tool. Alternatively there's a page that you can visit and handle the info in a more humanistic way.
https://en.gravatar.com/
Simply go there and signup. Then you can create avatars given any email address you want to link to. Additionally, you have option to create sort of a personal card with minimal information about you, like physical presentation cards do. How cool!!
You can know more about how to use or implement Gravatar API here with instructions for some common programming languages like Ruby, Python or PHP. It's super simple. Just generate an MD5 hash from your email address with no leading or tailing space and downcased, put it in the endpoint, and done.
Now, you can use this instead of hardcoded data on all your profiles that allows it, and you effectively concentrate all your avatars in a single place.