DWQA QuestionsCategory: ProgramUse PHP to generate random user avatars on the web side?
JellyBool asked 4 months ago

The web side uses php to generate random user avatars. You know the method or similar PHP library, which is to generate random avatars similar to secret apps,I happened to see a similar problem in Zhihu and became a porter.http://www.zhihu.com/question/26387811
Original author:Fang Zizi

This kind of head is calledIdenticon, don park first came up with this idea on January 18, 2007.
Generally speaking, if you don’t specify your own avatar on these websites, the websites will use itGravatarOr use identicon (gravatar also has related services) as the default avatar.
Identicon is a visual representation of hash value. The common generation method is based on IP address or email address. The server can distinguish users in the form of avatars through identicon, which can protect users’ privacy at the same time.
At first, identicon was a graph composed of 9 blocks. Later, its representation was extended from a third party to various graphic forms.
For details, please refer to the following wiki links. Other references refer to the open source implementation of various languages.
PS
Gravatar and WordPress are members of the same company. Like my head
justjavac
Whenever I comment on a website that supports gravatar (such as WordPress), as long as I leave my email, this avatar will be displayed.
reference resources:

For more languages, search GitHub:https://github.com/search?utf8=%E2%9C%93&q=identicon,You can use a PHP file to randomly generate avatar. You only need to attach two parameters: hash and size
Demo address:http://app.ispu.cn/identicon/
The generated files used are herehttps://github.com/chloetina/random_avatar,What do you think of these?
https://github.com/yzalis/Identicon
http://www.splitbrain.org/projects/monsterid
http://francisshanahan.com/index.php/identicon5/
https://github.com/seyDoggy/placeholder,http://www.gravatar.com/avatar/md5?s=size&d=dtype,You can also make a group of user avatars and put them in the website / picture / user avatar directory, then PHP reads the picture files in the directory, generates a list, and then uses a random number to obtain a picture in the list and return it to the front end

justjavac replied 4 months ago

Baidu identicon

5 Answers
justjavac answered 4 months ago

I happened to see a similar problem in Zhihu and became a porter.http://www.zhihu.com/question/26387811
Original author:Fang Zizi

This kind of head is calledIdenticon, don park first came up with this idea on January 18, 2007.
Generally speaking, if you don’t specify your own avatar on these websites, the websites will use itGravatarOr use identicon (gravatar also has related services) as the default avatar.
Identicon is a visual representation of hash value. The common generation method is based on IP address or email address. The server can distinguish users in the form of avatars through identicon, which can protect users’ privacy at the same time.
At first, identicon was a graph composed of 9 blocks. Later, its representation was extended from a third party to various graphic forms.
For details, please refer to the following wiki links. Other references refer to the open source implementation of various languages.
PS
Gravatar and WordPress are members of the same company. Like my head
justjavac
Whenever I comment on a website that supports gravatar (such as WordPress), as long as I leave my email, this avatar will be displayed.
reference resources:

For more languages, search GitHub:https://github.com/search?utf8=%E2%9C%93&q=identicon

Front end beam answered 4 months ago

You can use a PHP file to randomly generate avatar. You only need to attach two parameters: hash and size
Demo address:http://app.ispu.cn/identicon/
The generated files used are herehttps://github.com/chloetina/random_avatar

Logged off replied 4 months ago

Hello, I’m Daxing, 10 years in ten years The founder of me. I just read your answer. I hope I can talk. Ten years later, it will be a dream based social network. We want to use it to make young people’s social life more futuristic. Last month, we just got a million yuan Angel round financing from innovation Valley VC. Now we are recruiting web development talents to become our core members. You can add my wechat exchange: 18101620531. It’s also good to make friends:)

Cat food Knight answered 4 months ago

You can also make a group of user avatars and put them in the website / picture / user avatar directory, then PHP reads the picture files in the directory, generates a list, and then uses a random number to obtain a picture in the list and return it to the front end