如何生成随机的默认"gravatars".像在堆栈溢出?

编程入门 行业动态 更新时间:2024-10-23 11:30:42
本文介绍了如何生成随机的默认"gravatars".像在堆栈溢出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

对于那些没有上传图片或没有创建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".像在堆栈溢出?

本文发布于:2023-11-09 09:52:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572067.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:堆栈   quot   gravatars

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!