Magento Image Optimisation

The Problem

One of our clients recently needed a simple solution for automatically optimising their media/ and skin/ images. After trying a reputable module we decided it would be simpler and give us more control if we completed this using bash, cron, jpegoptim and optipng.

The Solution

Usage

bash img_optimiser.bash 5256000 &>> img_optimiser.log
0 * * * * bash /path/to/img_optimiser.bash 60 2>&1 >> /path/to/img_optimiser.log

The 2>&1 allows you to log stdout and stderr into one file from cron.


Tags: magentoimagesoptimisationbash