[GH-ISSUE #401] Support other file formats for avatar #154

Open
opened 2026-02-27 08:15:34 +03:00 by kerem · 5 comments
Owner

Originally created by @pixelrazor on GitHub (Dec 30, 2022).
Original GitHub issue: https://github.com/lldap/lldap/issues/401

Avatars can only be a JPEG currently. It would be nice if other formats (ex. PNG) were supported

Originally created by @pixelrazor on GitHub (Dec 30, 2022). Original GitHub issue: https://github.com/lldap/lldap/issues/401 Avatars can only be a JPEG currently. It would be nice if other formats (ex. PNG) were supported
Author
Owner

@nitnelave commented on GitHub (Jan 24, 2023):

The ldap attribute is jpegPhoto, I'm not sure how other file formats are handled. If someone knows more about it, I'm all ears.

<!-- gh-comment-id:1401623261 --> @nitnelave commented on GitHub (Jan 24, 2023): The ldap attribute is jpegPhoto, I'm not sure how other file formats are handled. If someone knows more about it, I'm all ears.
Author
Owner

@pixelrazor commented on GitHub (Jan 24, 2023):

My thinking here was the file upload can accept other formats, then convert to jpeg. No storage changes needed or anything, just FE changes

<!-- gh-comment-id:1402235850 --> @pixelrazor commented on GitHub (Jan 24, 2023): My thinking here was the file upload can accept other formats, then convert to jpeg. No storage changes needed or anything, just FE changes
Author
Owner

@nitnelave commented on GitHub (Jan 24, 2023):

There are several problems with that:

  • JPEG quality is configurable, it's hard to find a default that pleases everyone
  • PNG supports transparency, JPEG doesn't -> how to convert?
  • GIF has several frames, if we accept it we'd only be taking the first frame, it may not be what the user wants
  • WebP has several resolution in a single file, which resolution to choose?

and so on.

Those problems definitely have solutions, but that's not what I want to do with my time/code.

<!-- gh-comment-id:1402261974 --> @nitnelave commented on GitHub (Jan 24, 2023): There are several problems with that: - JPEG quality is configurable, it's hard to find a default that pleases everyone - PNG supports transparency, JPEG doesn't -> how to convert? - GIF has several frames, if we accept it we'd only be taking the first frame, it may not be what the user wants - WebP has several resolution in a single file, which resolution to choose? and so on. Those problems definitely have solutions, but that's not what I want to do with my time/code.
Author
Owner

@pixelrazor commented on GitHub (Mar 21, 2023):

Quic kreading into it - the image crate seems like the perfect solution. the only thing we'd need to sort out is the output jpeg quality.

this answer and the link for testing in it seems to suggest we lean towards 80-90. I'd almost suggest lower since it's for avatars, but i don't know if other applications might try to display it in a larger area? Either way, 90 would at least be a good start as is has minimal loss and has the largest impact on size

<!-- gh-comment-id:1478558092 --> @pixelrazor commented on GitHub (Mar 21, 2023): Quic kreading into it - the [image crate](https://docs.rs/image/latest/image/) seems like the perfect solution. the only thing we'd need to sort out is the output jpeg quality. [this answer](https://photo.stackexchange.com/questions/30243/what-quality-to-choose-when-converting-to-jpg) and the link for testing in it seems to suggest we lean towards 80-90. I'd almost suggest lower since it's for avatars, but i don't know if other applications might try to display it in a larger area? Either way, 90 would at least be a good start as is has minimal loss and has the largest impact on size
Author
Owner

@nitnelave commented on GitHub (Mar 23, 2023):

Sure, we can look into that, if you feel like implementing it. The conversion should be done client-side, though.

<!-- gh-comment-id:1481015331 --> @nitnelave commented on GitHub (Mar 23, 2023): Sure, we can look into that, if you feel like implementing it. The conversion should be done client-side, though.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#154
No description provided.