mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Make AvatarRenderedSizeFactor configurable and set it to 3 (#17951)
Save a bit of bandwidth by only requesting 3-times the rendered avatar size. Factor 4 is only really beneficial on a handful of mobile phones and I don't think they are the primary device we design for. Configurability contributed by zeripath. Fixes: https://github.com/go-gitea/gitea/pull/17422 Fixes: https://github.com/go-gitea/gitea/issues/16287 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
e78ee73d71
commit
cc129d2ca2
7 changed files with 22 additions and 16 deletions
|
@ -18,13 +18,15 @@ var (
|
|||
Avatar = struct {
|
||||
Storage
|
||||
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
MaxFileSize int64
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
MaxFileSize int64
|
||||
RenderedSizeFactor int
|
||||
}{
|
||||
MaxWidth: 4096,
|
||||
MaxHeight: 3072,
|
||||
MaxFileSize: 1048576,
|
||||
MaxWidth: 4096,
|
||||
MaxHeight: 3072,
|
||||
MaxFileSize: 1048576,
|
||||
RenderedSizeFactor: 3,
|
||||
}
|
||||
|
||||
GravatarSource string
|
||||
|
@ -55,6 +57,7 @@ func newPictureService() {
|
|||
Avatar.MaxWidth = sec.Key("AVATAR_MAX_WIDTH").MustInt(4096)
|
||||
Avatar.MaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(3072)
|
||||
Avatar.MaxFileSize = sec.Key("AVATAR_MAX_FILE_SIZE").MustInt64(1048576)
|
||||
Avatar.RenderedSizeFactor = sec.Key("AVATAR_RENDERED_SIZE_FACTOR").MustInt(3)
|
||||
|
||||
switch source := sec.Key("GRAVATAR_SOURCE").MustString("gravatar"); source {
|
||||
case "duoshuo":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue