Automatically optimise images that are uploaded to the SilverStripe CMS
Installation can be done either by composer or by manually downloading a release.
$ composer require joshcronin/silverstripe-optimisedimages
- Download the module from the releases page.
- Extract the files.
- Make sure the folder after being extracted is named 'silverstripe-optimisedimages'.
- Place this directory in your sites root directory. This is the one with framework and cms in it.
/dev/buildon your site.
The plugin extends to the
onAfterUpload method of the
Image object. Whenever an
Image object is uploaded it will optimise the image using the options defined in
There are three keys in the config that are used regardless of the optimisation provider. These are
Use accepts two values
TinyPNG. The value is used to decide which service to use to optimise the images.
SaveOrginal accepts a boolean, if true it will keep the original image - unoptimised - at the directory specified in the
OriginalDir accepts a string representing the path to the directory that the original images should be saved to. This is only used if
SaveOriginal is set to