Image Optimiser

There is a native tool in MageStack to losslessly optimise images. This means images use less disk space and are served to the customer faster - without losing any quality.

The utility can be accessed by running,

Only a single option (target directory) is required to execute the command. This will run a lossless optimise on images however you can pass the -l parameter to perform lossy optimisation.

Lossy compression will significantly reduce the space used at the cost of image quality, however the optimiser will intelligently try to minimise the quality reduction.

! It's recommended that you test the image optimisation process on a development or staging copy of your store before running it on live, this will allow you to assess the quality of the process first. Usage: [options] [directory]

          -l             Perform lossy compression on images
          directory      Directory containing images to optimise


Running a lossless optimise on a single directory

You can optimise your Magento's media directory by passing the path to the script. The script will only optimise un-optimised files and will track the files it has already processed. /microcloud/domains/example/domains/

Running a lossy optimise on a single directory

Running the optimiser in lossy optimisation mode is as simple as adding the -l parameter: -l /microcloud/domains/example/domains/

Running optimise on multiple directories

Simply run the command multiple times for each directory, /microcloud/domains/example/domains/ /microcloud/domains/example/domains/

Running optimise via cron

To optimise files every day at 03:00, run

crontab -e

Then add the following for Lossless compression:

0 3 * * * /microcloud/scripts_ro/ /microcloud/domains/example/domains/

Or for Lossy compression:

0 3 * * * /microcloud/scripts_ro/ -l /microcloud/domains/example/domains/