bootstrap.php
Resize assets to a maximum width after uploading and replace them with the resized ones
Copy this code snippet to /config/bootstrap.php
.
You can set the max width in you config file with image_max_width: 1024
or use
the default of 1920.
The upload process takes a while for large images, because
- the original image is uploaded,
- Colorthief picks the colors from the original file,
- SimpleImage resizes the file,
- and if you upload multiple images at once, steps 1-3 are multiplied
Related discussion: https://discourse.getcockpit.com/t/how-to-downsize-uploaded-image-assets-to-max-width-height/883
A modified version with maxHeight and group acl variables by @creatingo: https://discourse.getcockpit.com/t/how-to-downsize-uploaded-image-assets-to-max-width-height/883/5?u=raffaelj