对于那些没有上传图片或没有创建Gravatar图标的用户,Stack Overflow如何自动生成gravatars?
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?
推荐答案显示随机"的彩色gravatars,因为此查询字符串参数已添加到每个gravatar源URL:d=identicon
The 'random' colorful gravatars are displayed because this query string parameter is being added to every gravatar source URL: d=identicon
这样做是为了,如果用户没有与他的电子邮件关联的图像,则显示此随机"图像,而不是默认的蓝色图像.
This 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:
但是,包含了d=identicon参数的相同URL显示如下:
Yet, the same URL with the d=identicon parameter included, shows this:
这是示例使用的URL:www.gravatar/avatar/94d093eda664addd6e450d7e9881bcad?s=32&d=identicon&r=PG
This is the URL used for the example: www.gravatar/avatar/94d093eda664addd6e450d7e9881bcad?s=32&d=identicon&r=PG
通过这些图像(称为图标)的方式并不是真正随机的,而是基于在电子邮件哈希上.
By 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.
更多推荐
如何生成随机的默认"gravatars".像在堆栈溢出?
发布评论