valiner/identicon-avatar

php生成identicon头像

0.0.1 2019-01-24 07:49 UTC

This package is auto-updated.

Last update: 2024-03-30 00:23:42 UTC


README

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