赞
踩
- package main
-
- import (
- "fmt"
- "github.com/o1egl/govatar"
- )
- //go get -u github.com/o1egl/govatar/...
- func main() {
- username:="testname"
- filename:="avatar_"+username+".jpg"
- avatarSavePath:="./"+filename
- avatarGetUrl:="192.168.1.1/"+filename
- err := govatar.GenerateFileForUsername(govatar.MALE,username,avatarSavePath)
- if err != nil {
- fmt.Println(err)
- return
- }
- println(avatarGetUrl)
- }
可以随机生成8000W个图片,不过头像模板实在是模糊,生成的不美观。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。