LibreChat icon indicating copy to clipboard operation
LibreChat copied to clipboard

Enhancement: Resize images on upload

Open danshapiro opened this issue 1 year ago • 5 comments

What features would you like to see added?

Resize uploaded pictures to meet server size requirements

More details

When submitting an image in the chat window, large images produce a vague "an error occurred while uploading the file" error. I suggest resizing in the browser before uploading.

Which components are impacted by your request?

No response

Pictures

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

danshapiro avatar Jan 21 '24 04:01 danshapiro

Hi thanks for checking out the project!

I originally made it like this but opted out of it since it can be inconsistent and not work across multiple devices on the client-side, also it adds another package to bundle.

I will deliberate whether to add this as an optional feature. I'm already planning on allowing more configuration for file uploads (like max size) in an upcoming update.

danny-avila avatar Jan 21 '24 14:01 danny-avila

Thanks Danny! This is particularly important for mobile, where uploading a picture you just took is a great use case - but downsizing is clumsy. In any case, I'm grateful for your work on the wonderful project!

danshapiro avatar Jan 22 '24 09:01 danshapiro

can i work on this? @danny-avila

aniruddhapw avatar Jun 21 '24 06:06 aniruddhapw

Even I would Love to collaborate @aniruddhapw @danny-avila

tashviks avatar Jun 22 '24 11:06 tashviks

Feel free to submit a PR. Note that it should be optional as not all browser resize methods work across all browsers.

Also the backend resizing should not be disabled but the resulting browser dimensions should "prevent" it from resizing.

See here: https://github.com/danny-avila/LibreChat/blob/main/api/server/services/Files/images/resize.js

danny-avila avatar Jun 22 '24 15:06 danny-avila