SmushIt: A MODX extra for optimising images

This MODX extra optimises and compresses PNG and JPEG images for better performance using the resmush.it API. This will help with Google Page Speed and can reduce image sizes by up to 70%.

What does it do?

This snippet optimises and compresses PNG and JPEG images for better performance using the resmush.it optimisation API. This will help with Google Page Speed and can reduce image sizes by up to 70%. This will overwrite any existing images so is intended to be used as an output filter after pthumb or similar.

This works best on alpha transparent PNGs but it normally creates some saving on JPEG images too.


Examples

Here are some examples of MODX SmushIt in action and the savings made on various image formats and sizes.

Unoptimised calendar image
Unoptimised JPEG 500×500 86.3 kB
Optimised calendar image
Optimised JPEG 500×500 80.0 kB

Unoptimised screenshot image
Unoptimised PNG 1000×1000 693.3 kB
Optimised screenshot image
Optimised PNG 1000×1000 226.6 kB

SmushIt Snippet

This snippet expects to be used as an output filter so could be used after you have resized the image using pthumb, phpthumbsup or similar. You could also use this on it's own if you simply wanted to optimise the image.

[[*MyImage:pthumb=`&w=300&h=300`:smushit]]

This will use pthumb to resize the image and then smush it to optimise the file. The thumbnail image is overwritten once and from then on is optimised. This affects first uncached performance so you should review if this is worthwhile. After caching it runs fine and then helps the page load speed by using the new files.

As this is a first release, please use caution when using on a production site.


Download

I currently use this on a few sites but would like your help in testing and reporting any bugs. Your feedback and feature requests are most welcome.

Download MODX SmushIt


Comments 0

There are no comments on this yet.

Got something to say?

Join the discussion! You know how these things work; enter your details and comments below and be heard.

  1. Allowed tags: <b><i><br>