danny-avila / LibreChat

Enhanced ChatGPT Clone: Features OpenAI, Assistants API, Azure, Groq, GPT-4 Vision, Mistral, Bing, Anthropic, OpenRouter, Vertex AI, Gemini, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. More features in development
https://librechat.ai/
MIT License
15.17k stars 2.52k forks source link

Enhancement: Resize images on upload #1604

Open danshapiro opened 5 months ago

danshapiro commented 5 months ago

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

danny-avila commented 5 months ago

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.

danshapiro commented 5 months ago

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!

aniruddhapw commented 1 week ago

can i work on this? @danny-avila

tashviks commented 1 week ago

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

danny-avila commented 1 week ago

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