Skip to content

Maintain aspect ratio of non-square avatar uploads #1268

@tobias--

Description

@tobias--
  • Gitea version (or commit ref): 1.1.0
  • Git version: irrelevant
  • Operating system: irrelevant
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When uploading a non-square image as an avatar, it gets resized to a square image. This results in distorted avatars. In my opinion, It would be reasonable to crop the image and maintaining the original aspect ratio.

https://github.com/go-gitea/gitea/blob/master/models/user.go#L431

Unfortunately, the used library for image resizing (https://github.com/nfnt/resize) does not seem to support cropping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions