Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reduce the resolution of original photos when uploading? #394

Open
rik43 opened this issue Apr 25, 2023 · 4 comments
Open

How to reduce the resolution of original photos when uploading? #394

rik43 opened this issue Apr 25, 2023 · 4 comments

Comments

@rik43
Copy link

rik43 commented Apr 25, 2023

  1. Users upload original photos from the phone at 10+Mpx. How to reduce photo resolution when uploading e.g. to 1600px on the long side?

  2. Need to reduce the resolution of previously uploaded original photos.

Any ideas?

@beshoo
Copy link

beshoo commented Jul 6, 2023

+1

@rik43
Copy link
Author

rik43 commented Jul 6, 2023

temporarily made a script that goes through all the media, and if their file size and resolution are greater than the specified one, it reduces them, overwriting the original file.
The file size is checked first - it's fast.
This is not suitable for those who have a lot of media, but for an online store it suits.

@beshoo
Copy link

beshoo commented Jul 6, 2023

can you share the code?

@rik43
Copy link
Author

rik43 commented Jul 6, 2023

here.
https://gist.github.com/rik43/3752894678b6c067d247e3e3d0e595e3
but keep in mind that we have our own custom path generator. file paths are not standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants