|
|
@ -14,9 +14,10 @@ import ( |
|
|
|
"github.com/issue9/identicon" |
|
|
|
"github.com/issue9/identicon" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const AVATAR_SIZE = 290 |
|
|
|
// AvatarSize returns avatar's size
|
|
|
|
|
|
|
|
const AvatarSize = 290 |
|
|
|
|
|
|
|
|
|
|
|
// RandomImage generates and returns a random avatar image unique to input data
|
|
|
|
// RandomImageSize generates and returns a random avatar image unique to input data
|
|
|
|
// in custom size (height and width).
|
|
|
|
// in custom size (height and width).
|
|
|
|
func RandomImageSize(size int, data []byte) (image.Image, error) { |
|
|
|
func RandomImageSize(size int, data []byte) (image.Image, error) { |
|
|
|
randExtent := len(palette.WebSafe) - 32 |
|
|
|
randExtent := len(palette.WebSafe) - 32 |
|
|
@ -39,5 +40,5 @@ func RandomImageSize(size int, data []byte) (image.Image, error) { |
|
|
|
// RandomImage generates and returns a random avatar image unique to input data
|
|
|
|
// RandomImage generates and returns a random avatar image unique to input data
|
|
|
|
// in default size (height and width).
|
|
|
|
// in default size (height and width).
|
|
|
|
func RandomImage(data []byte) (image.Image, error) { |
|
|
|
func RandomImage(data []byte) (image.Image, error) { |
|
|
|
return RandomImageSize(AVATAR_SIZE, data) |
|
|
|
return RandomImageSize(AvatarSize, data) |
|
|
|
} |
|
|
|
} |
|
|
|