I wrote an addon to resize uploaded images automatically. It might share some behavior with ImageStyles, but I wanted to replace the uploaded images with smaller ones. A client tends to upload giant images and everytime my scripts try to create thumbnails, e. g. after cleaning the cache, it takes ages to process them.
Addon
Related discusson
Usage
A copy of the original file is stored in /uploads/full/filename.jpg
. The default file will be replaced with the resized file. From now on, you don’t have to create thumbnails from 8MB sized files again, but you are still able to use the original file, if you want to.
If users upload very large images, it will take a while to process the files.
There is no option in the assets manager to choose the original file, but your api autput has two additional keys:
original keys:
"path": "/2019/07/02/filename.jpg",
"title": "DSC07504.JPG",
...
extra keys:
"sizes": {
"full": {
"path": "/full/filename.jpg",
"width": 4912,
"height": 3264,
"size": 4390912
}
},
"resized": true,
Options
Use the GUI or add options to /config/config.yaml
.
If you set maxWidth
or maxHeight
to 0
(zero), the value will be ignored.
imageresize:
enabled: true # boolean, default: false
keepOriginal: true # boolean, default: true
moveOriginalTo: original # string, default: "full"
maxWidth: 1024 # int, default: 1920
maxHeight: 1024 # int, default: 0
method: bestFit # string, default: bestFit
quality: 80 # default: 100