mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-15 20:09:18 -05:00
Support resizing of local avatars #9449
Open
opened 2025-11-02 08:39:11 -06:00 by GiteaMirror
·
18 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.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.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#9449
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @somera on GitHub (Aug 22, 2022).
Description
When I see the size=84 parameter in the URL I think gitea should send 84x84 pixel big icon. But I see, that Gitea is sending 290x290 pixel big icon.
With 2000+ organizations it's need ~10 seconds, 2000+ requests and some MB's.
Gitea Version
1.17.1
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.25.1
Operating System
Ubuntu 20.04.4
How are you running Gitea?
Self hosted gitea-1.17.1-linux-amd64
Database
PostgreSQL
@silverwind commented on GitHub (Aug 23, 2022):
Yes, seems like a bug. The intention is for the server to send 84px in this case.
@somera commented on GitHub (Aug 25, 2022):
A can't compare this to the 1.16.x version. But in the 1.16.x release loading a page with a lot of orgas war faster. Looks like new bug in 1.17.x.
@lunny commented on GitHub (Aug 25, 2022):
But they will be cached?
@somera commented on GitHub (Aug 25, 2022):
Yes. But this is "strange". When I click in gitea I see "memory cached" and its fast.
When I try to migrate new project it slower (8-10 seconds) and I see "disk cache".
Tested with Chrome (Version 104.0.5112.102 (Offizieller Build) (64-Bit))
@silverwind commented on GitHub (Aug 25, 2022):
Not sure when a browser will decide to offload to disk, but we should probably make the hardcoded 5 minute cache duration on avatars configurable:
dc0253b063/routers/web/user/avatar.go (L18-L21)@silverwind commented on GitHub (Aug 25, 2022):
https://github.com/go-gitea/gitea/pull/20958 restores avatars to use STATIC_CACHE_TIME again which defaults to 6h so we can hit the cache much more than before.Turns out it wasn't needed.@silverwind commented on GitHub (Aug 25, 2022):
Back to this issue's topic: The problem is that the
sizeargument only works for external avatar services like Gravatar. The local avatar handler ignores thesizeargument and always serves the full-size avatar from storage.What needs to be done:
/avatars/*request handler respectsizeand resize it.(Can someone rename issue to "Support resizing of local avatars"? I can't)
@somera commented on GitHub (Aug 25, 2022):
@silverwind I renamed it
@somera commented on GitHub (Sep 7, 2022):
Will be there a fix for the next (1.17.3 or 1.18.x) release?
@somera commented on GitHub (Sep 9, 2022):
Status with 1.17.2 for the start page with 2192 organisations.
Chrome:

FF:

@somera commented on GitHub (Sep 10, 2022):
I took a look on Gitea 1.16.x. This version has the same scale bug.
But I thin that with my gitea usage (generating a lot of organizations) I reached some subability and load time limitations. Just create on you local instances ~2000 orgas for see what I mean. On gitea.com are ~1140 orgas. If you log there with admin permissions than you could analyze my experience with the loading time.
This make no sense for me.
Why there is an icon needed in the drop list?
On the start page there is a search field for repos. But not for orgas. All orgs will be loades.

This is not consistent.
@somera commented on GitHub (Sep 11, 2022):
I have one idea to solve this problem for the avatar url calls. Just add new property:
Is this set to false, than in all lists (start page/issues/pull requests/milestones, new repo/mirror) the avatar image url in the select list will be not shown. And the scale bug should be fixed to.
@silverwind I wanted add an nginx proxy with image scaling/caching. But I found that the scale size don't correspond to the rendered sice in the browser. Some examples.
@somera commented on GitHub (Oct 9, 2022):
Last days I installed Nginx as proxy and added avatar scaling. This is reducing only the amount of data which is sended to the client.
I see here two problems:
@somera commented on GitHub (Oct 16, 2022):
@somera commented on GitHub (Oct 18, 2023):
I have now an nginx proxy with working scaling. Cause my gitea with 3200 avatars is "slow".
/etc/nginx/nginx.conf:
/etc/nginx/conf.d/gitea.conf:
Should this stay open? For me, can this be closed.
@silverwind commented on GitHub (Oct 18, 2023):
Keep it open, we still want to fix this and implement resizing on upload and ideally resize any existing oversized avatars.
@SrAquaGenius commented on GitHub (Apr 3, 2024):
Hi, while trying to solve this issue, I have some questions:
That can explain why some avatars/url-size are in one-to-two ratio.
I am also interested in coding avatar resizing availability as a new feature!
Greetings
@somera commented on GitHub (Aug 7, 2024):
Who can answer this questions?
Ups ... I would say: too big!
I would say: yes!
In my solution with nginx I store every requested size. And this solution works fast.