0

I was looking at the discussion settings in WordPress and near the "Default Avatar" option I saw that it said the following:

For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.

(I bolded the second part.) I'm just curious as to how these avatars are "generated" based on email addresses.

0

The way gravatar works is that it creates an MD5 of the email address and passes that to gravatar.com. If an avatar exists for that hashed email address, then it gets returned.

If not, then it generates a random one based on the data in the hash. Essentially, it's arbitrary. There's code in there that basically says "if character 3 is A, use this color" and so forth. This means that the same email generates the same avatar every time, but still makes it randomish.

More info and examples: http://blog.gravatar.com/2008/04/22/identicons-monsterids-and-wavatars-oh-my/

  • Can't upvote your answer but I would. :) Thanks. – apparatix Aug 3 '12 at 21:16
0

Wordpress uses email address used for comment to get the avtar directly from https://en.gravatar.com/ which is a site that provides api to show globally recognized avtar for that email address.

  • So the image itself isn't generated, it's just taken from Gravatar? Why does it say that in the default options after it says "For users without a custom avatar..."? Thanks for the answer by the way. :) – apparatix Aug 3 '12 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.