Browse Source

Use a gopher as default avatar (rather than the gravatar logo) (#3208)

Also changes the avatar from a jpeg to a png, to allow for
transparent background. The indexed png is also smaller in size.

Note that at the moment the default avatar is only used when
the user requested a custom avatar and the custom avatar file
is not found (should never happen).

In the future the default avatar could be used as a default
return when by-mail avatar lookups fail too (both gravatar
and libravatar support passing a default)
pull/3174/head
Sandro Santilli 9 years ago committed by 无闻
parent
commit
8a248696e9
  1. 2
      models/user.go
  2. 2
      modules/base/tool.go
  3. BIN
      public/img/avatar_default.jpg
  4. BIN
      public/img/avatar_default.png

2
models/user.go

@ -240,7 +240,7 @@ func (u *User) GenerateRandomAvatar() error {
} }
func (u *User) RelAvatarLink() string { func (u *User) RelAvatarLink() string {
defaultImgUrl := "/img/avatar_default.jpg" defaultImgUrl := "/img/avatar_default.png"
if u.Id == -1 { if u.Id == -1 {
return defaultImgUrl return defaultImgUrl
} }

2
modules/base/tool.go

@ -207,7 +207,7 @@ func HashEmail(email string) string {
// AvatarLink returns avatar link by given email. // AvatarLink returns avatar link by given email.
func AvatarLink(email string) string { func AvatarLink(email string) string {
if setting.DisableGravatar || setting.OfflineMode { if setting.DisableGravatar || setting.OfflineMode {
return setting.AppSubUrl + "/img/avatar_default.jpg" return setting.AppSubUrl + "/img/avatar_default.png"
} }
return setting.GravatarSource + HashEmail(email) return setting.GravatarSource + HashEmail(email)

BIN
public/img/avatar_default.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

BIN
public/img/avatar_default.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Loading…
Cancel
Save