#StandWithUkraine

Using hash generated avatars

gravatar Ben of frogstr had recently posted on how gravatar can help your brand. It is indeed nice service (I am going to explain in details below) but taking in account people that simply hadn’t bothered to setup gravatar yet there is one awesome way to fix no-avatars problem on your blog.

That is pulling hash generated avatars from gravatar service.

Email hash

I had posted on some hash tricks in the past. Repeating basic idea - hashing is getting long weird looking string of characters from some input. In case of gravatar input for hash is email address you fill in when making comments on blogs. Hash allows to use your email for gravatar service without exposing it – it is not possible to calculate email from hash.

Gravatar service

Gravatar is online service owned by Automattic (developers of WordPress) that serves avatar images responding to specially formed URLs with MD5 hash in them.

Basically:

  1. Register on gravatar site with your email and upload image for avatar.
  2. Every gravatar-enabled blog will start showing that image near your comments.

Cool, isn’t it? Problem is for every person with gravatar there are hundreds without one. So comment discussions still look faceless with occasional gravatar splashes.

Inner workings

I said above that gravatar request is made with URL. So to see it I need hash email. I can either get it from gravatar image properties (right-clicking image in browser is usual way to get there) or go to online MD5 generator and calculate it.

Hash for my personal email is f2b6e0c8a09d8faadb50d56890e2528c. When I comment request is made to the following link: https://www.gravatar.com/avatar/f2b6e0c8a09d8faadb50d56890e2528c.jpg

And my gravatar is downloaded and pasted in page.

gravatar

But what if I have no gravatar?

My contact email for this blog is contact@rarst.net. Its hash is ab89ce39f47b327f1c85e4019e865a71. And link: https://www.gravatar.com/avatar/ab89ce39f47b327f1c85e4019e865a71.jpg

gets ugly placeholder image:

gravatar

Here come hash generated avatars!

Adding some parameters to URL makes gravatar send not an boring image but one generated from hash. So different hashes get different images, but as long as same email is used and same hash is calculated – same image is going to show for it.

Identicon https://www.gravatar.com/avatar/ab89ce39f47b327f1c85e4019e865a71.jpg?d=identicon

gravatar

MonsterID https://www.gravatar.com/avatar/ab89ce39f47b327f1c85e4019e865a71.jpg?d=monsterid

gravatar

Wavatar https://www.gravatar.com/avatar/ab89ce39f47b327f1c85e4019e865a71.jpg?d=wavatar

gravatar

How to use them

Go to Settings > Discussion in WordPress admin area. It has setting that allows to choose what to show instead of placeholder image.

wordpress_gravatar_settings

If it doesn’t work with your theme or you use different platform look for solutions in gravatar implementer’s guide and using gravatars WordPress Codex page.

Overall

Gravatars complemented by hash generated versions are very nice visual clue for comments in blog. It allows to easily spot active commentators or acquaintances even across different blogs.

MonsterID and Wavatar are bit too… Weird. :) I went with Identicon for this blog. So if you don’t have gravatar yet - comment below this post and check out cool geometrical pattern it assigns to you.

Link https://www.gravatar.com/

Related Posts

9 Comments

  • Ben from frogstr #

    Thanks for the luv Rarst. This is a really nice post and that will actually let me put something else than the "Mystery Man" as the default Gravatar! I'm thinking about making a custom one...
  • Rarst #

    @Ben Mystery man is soo boring. :) Try identicons, I completely like them. By the way setting blank has pretty nice effect too if place for gravatar is not obviously visual. No default placeholders but still showing gravatars for those who have them.
  • Lyndi #

    What a great idea. I just set my blog to identicons and they look just wonderful. I love the fact that there is now a bit more color and everyone without a gravatar will still have a different graphic shown. I implemented this and it immediately changed all the previous 'mystery man' graphics. Thanks for a great tip.
  • Rarst #

    @Lyndi Glad to be of use. :) Sometimes default options are not the best ones.
  • gry planszowe #

    Interesting article, i have bookmarked your blog for future referrence, thanks
  • Rarst #

    @gry planszowe Glad you liked it, welcome to blog. :)
  • Animoto.com – generate videos from photos and music | Rarst.net #

    [...] – generate videos from photos and musicSometimes you find a topic, sometimes topic finds you. Gravatar blog (I am subscribed to for some reason) had mentioned Animoto today and awesome plus [...]
  • matt #

    why don't more sites use gravatars? are there security issues involved?
  • Rarst #

    @matt Well, it's personal choice of web developer to use or not gravatars at his site. There are no security issues - email addresses are never transferred to or from gravatar service, so there is no possibility of them being intercepted or harvested.