How does Stack Overflow auto-generate the gravatars for those users who do not upload a picture or who have not created a Gravatar icon?
Where do these random avatars come from, and how can I generate them for my own site?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The ‘random’ colorful gravatars are displayed because this query string parameter is being added to every gravatar source URL:
d=identiconThis is done so that if the user doesn’t have a gravatar image associated with his email, this ‘random’ image is displayed, instead of the default blue gravatar image.
The following displays the ‘default’ blue image because the parameter is not included:
Yet, the same URL with the
d=identiconparameter included, shows this:This is the URL used for the example:
https://www.gravatar.com/avatar/94d093eda664addd6e450d7e9881bcad?s=32&d=identicon&r=PGBy the way these images (called Identicons) are not really random, but are generated based on the email hash.
See How is the default user avatar generated? for some Language Implementations of this algorithm.