The Perch Image Optimiser will compress images that are generated by the CMS. This will improve loading times reduce the bandwidth required for your site.
Before installing this package your site must be hosted on an environment that allows you to install and run other software through PHP such as a VPS. The application makes use of the following utilities:
To install the above on Ubuntu:
sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo npm install -g svgo
sudo apt-get install gifsicle
MacOS (Homebrew):
brew install jpegoptim
brew install optipng
brew install pngquant
brew install svgo
brew install gifsicle
- PHP >= 7
- Perch / Runway >= 3.0
Upload the redfinch_optim
directory to perch/addons/apps
. Once complete you should see the app appear in the sidebar menu.
If not already, you should enable Scheduled Tasks for the optimisation tasks to be automatically run.
Once installed there are a wide variety of settings that can be modified depending on your requirements:
- Enable or disable optimisation tools
- Set the compression amount
- Strip file meta data for smaller sizes
- Enable or disable SVG optimisation plugins
The optimiser task will run once every 24 hours and will use a high level of CPU power to compress images. If you find that this is too much you can:
- Reduce the compression level. PNG optimisation can be particularly resource intensive
- Increase the image quality
- Disable the particular optimiser.
You can additionally set a max execution time in the Perch settings panel. By default this is set to 30 seconds.
This addon will only work for images that are stored locally. Files using cloud storage providers such as Amazon S3 cannot be optimised using this tool.
If you are not on a platform that can install and run the tools listed in the prerequisites section then the official Perch Kraken application may be suitable.
Spatie and Freek Van der Herten for the Image Optimizer package.