Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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/

share|improve this answer
    
Can't upvote your answer but I would. :) Thanks. –  apparatix Aug 3 '12 at 21:16

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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