lemmy-ui icon indicating copy to clipboard operation
lemmy-ui copied to clipboard

Explain how "Uploaded image is too large!" in avatar upload

Open Justinzobel opened this issue 2 years ago • 4 comments

Requirements

  • [X] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a feature request? Do not put multiple feature requests in one issue.
  • [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Is your proposal related to a problem?

When uploading an avatar that is too large an error appears Uploaded image is too large! but doesn't tell the user what about their image is too large. Is it the width, height or size on kB?

Describe the solution you'd like.

Explain to the user which aspect of their image is too large in the popup e.g.

Image is above 1MB size limit Image is too wide, maximum width 500px Image is too tall, maximum height 500px

Describe alternatives you've considered.

Alternatively specify these limits on the page under the Avatar section in Settings.

Additional context

No response

Justinzobel avatar Feb 17 '24 23:02 Justinzobel

That error message comes from pictrs error too_large. It looks like pictrs has various configurable limits for image size, like max width, height, area, filesize etc. Best ask your admin what exactly is configured.

cc @asonix Can pictrs return more specific errors in this case?

Nutomic avatar Feb 19 '24 09:02 Nutomic

pict-rs is more specific for errors like this, and I'm actually having trouble figuring out where the too_large error is coming from. pict-rs is capable of differentiating between file size errors, width errors, height errors, and area errors and should respond appropriately. 0.5 even adds error codes to make matching on these errors easier

asonix avatar Feb 19 '24 18:02 asonix

The only place I found this string is in the lemmy-ui code, and its expecting pictrs to respond with such a message.

Nutomic avatar Feb 21 '24 13:02 Nutomic

This is most likely a lemmy-UI issue then. I'll transfer it.

dessalines avatar Feb 21 '24 15:02 dessalines