images_optimizer
Introduction
The Images Optimizer module provides a simple way to optimize uploaded images.
Every uploaded image is automatically optimized if its mime type is supported by one of the registered optimizers. The original uploaded image is destroyed in the process.
Additionally, if you use image styles, created derivative images will also be optimized.
We provide two basic optimizers that handle JPEG and PNG images, but you can easily create your own if they do not fit your needs.
Requirements
The module requires the following modules:
If you are using the two provided optimizers, the module requires these additional libraries:
Installation
Install as you would normally install a contributed Drupal module. See: Installing Modules for further information.
If you are using the two provided optimizers:
- Install pngquant. See https://pngquant.org/#download
- Install jpegoptim. See https://github.com/tjko/jpegoptim
Configuration
Configure the module in "Configuration" > "Media" > "Images Optimizer".
You can select the optimizers you want to use and configure their options.
If you need a more advanced configuration, you should create your own optimizer by registering a service that implements the OptimizerInterface interface, and by tagging it with the images_optimizer.optimizer tag.