advanced-nova-media-library icon indicating copy to clipboard operation
advanced-nova-media-library copied to clipboard

How to reduce the resolution of original photos when uploading?

Open rik43 opened this issue 2 years ago • 4 comments

  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?

rik43 avatar Apr 25 '23 06:04 rik43

+1

beshoo avatar Jul 06 '23 11:07 beshoo

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.

rik43 avatar Jul 06 '23 11:07 rik43

can you share the code?

beshoo avatar Jul 06 '23 11:07 beshoo

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

rik43 avatar Jul 06 '23 11:07 rik43