Mura Li d77176912b | 5 years ago | |
---|---|---|
.. | ||
.gitignore | 5 years ago | |
.travis.yml | 5 years ago | |
LICENSE | 8 years ago | |
README.md | 5 years ago | |
block.go | 8 years ago | |
doc.go | 8 years ago | |
identicon.go | 8 years ago | |
polygon.go | 8 years ago |
根据用户的IP、邮箱名等任意数据为用户产生漂亮的随机头像。
// 根据用户访问的IP,为其生成一张头像
img, _ := identicon.Make(128, color.NRGBA{},color.NRGBA{}, []byte("192.168.1.1"))
fi, _ := os.Create("/tmp/u1.png")
png.Encode(fi, img)
fi.Close()
// 或者
ii, _ := identicon.New(128, color.NRGBA{}, color.NRGBA{}, color.NRGBA{}, color.NRGBA{})
img := ii.Make([]byte("192.168.1.1"))
img = ii.Make([]byte("192.168.1.2"))
go get github.com/issue9/identicon