/identicon-avatar

📷生成identicon头像,头像图片生成 http://165.154.148.105:8088

Primary LanguagePHP

identicon-avatar

Build Status 996.icu LICENSE

identicon 根据一个字符串(可以是用户的ID或者IP)的哈希值生成大量不重复的头像 很多大型IT网站上可以见到,比如 Github、Sourceforge、Stackoveflow。

安装

$ composer require valiner/identicon-avatar -vvv

使用

非laravel

<?php
require __DIR__.'/vendor/autoload.php';

use Valiner\IdenticonAvatar\Identicon;

$identicon = new Identicon();
//浏览器输出'sdp'的125px的图像

$identicon->getAvatar('sdp',125);

laravel

app('identicon')->getAvatar('sdp',125);

方法

浏览器输出'sdp'的125px的图像

$identicon->getAvatar('sdp',125)

保存'sdp'的125px的图像的图像到本地

$identicon->saveAvatar('sdp',125,__DIR_.'/test.png')

获取'sdp'的125px的图像的的BASE64

$identicon->getAvatarDataUri('sdp',125)

License

MIT