- Download and unzip
- Copy the
ImageOptimizer
folder intosite/addons/
.
You can view some optimization statistics and choose whether to automatically optimize the original Assets, the Glide images or both under Tools
> Optimizer
.
Run the please optimize
command to optimize all your existing image Assets and clear the glide cache.
The addon will use the following optimizers if they are available on your system:
It will try to find the executables in the following paths on your server:
/usr/local
/usr/local/bin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
/bin
/sbin
Sounds pretty technical, huh? Don't worry: ImageOptimizer comes with batteries included! 🔋⚡
The addon includes precompiled versions of these optimizers for Linux, MacOS and Windows. If an optimizer is not available on your server it will try to use the included version. This will work with most servers and configurations, but if for some reason it doesn't, you can always try to install the optimizers yourself.
Here's how to install all the optimizers on Ubuntu:
sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo apt-get install gifsicle
Here's how to install the optimizers on MacOS (using Homebrew):
brew install jpegoptim
brew install optipng
brew install pngquant
brew install gifsicle
Aside from using the included optimizers it is also possible to change their default configuration or add some custom optimization tools like MozJPEG or cwebp by enabling the advanced settings. For each optimizer you will have to provide the mimetype of the images you want it to optimize and the command you would like to run on the server.
Please make sure the path to the executable and the arguments are correct. You can use :file
to reference the full path to the image you are optimizing and :temp
to use a temporary output file if the optimizer requires it. The contents of the :temp
file will automatically be copied back to the original file after the optimization.
For example, if you would like to use MozJPEG you could enter the following:
Type | Command |
---|---|
image/jpeg | /usr/local/mozjpeg/bin/cjpeg -quality 85 -optimize -outfile :temp :file |