Example #1
0
func (this *User) GetAvatarUrl(size string) string {
	return fmt.Sprintf("https://secure.gravatar.com/avatar/%v?%v",
		util.Md5String(strings.ToLower(this.AvatarEmail)),
		(url.Values{
			"s": {size},
			"d": {"retro"}, // TODO: 自定义
		}).Encode())
}
Example #2
0
func NewUserStatusVM(org UserStatus) (rst *UserStatusVM) {
	rst = &UserStatusVM{UserStatus: org}
	rst.AvatarUrl = fmt.Sprintf("http://www.gravatar.com/avatar/%v?s=32&d=retro", util.Md5String(strings.ToLower(rst.User.AvatarEmail)))
	return
}