Automaticly optimise all uploaded & resampled images in SilverStripe
A module to automatically optimise/compress both uploaded as well as any resampled
(cropped, scaled etc) images in SilverStripe. Images (JPG, PNG & GIF) are automatically
optimised, provided you have the correct binaries installed (see "Installation" below).
The module overrides the default
FlysystemAssetStore to first optimise the image
before adding the image to the store. It works transparently, and includes a task to
optimise all existing (previously created) images.
The module uses spatie/image-optimizer and will use the
following optimisers if they are both present and in your default path on your system:
composer require axllent/silverstripe-image-optimiser
sudo apt-get install jpegoptim optipng pngquant gifsicle
apk add jpegoptim optipng pngquant gifsicle
Assuming you have the necessary binaries installed, it should "just work" with the default settings
once you have flushed your SilverStripe installation.
If you need to optimise any previously-uploaded images, see Currently this has been disabled as it causes corruption due to filehash mismatches (and upgrade issues to >= 4.4.0). Once I have thought of a more elgant method I will enable it. In the meantime pull requests are welcome.
This should only be needed once for older images as any new images uploaded will
get automatically optimised.
For custom optimisation settings, please refer to the
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem