MattWilcox/Adaptive-Images — pull request #143 by metadan (2014-02-14 17:47:24+00:00)
Title: Added automatic tinypng.com support

Hi, I've added tinypng.com support to your adaptive images. This greatly increases the compression on the png image side of it.

Sorry about the formatting differences, it should be PSR compliant from my end so you can just do ignore all spaces in the merge.

The main bits you need to consider are lines 404-430 where I've integrated the serving/generation flow of the png cache file. It works on the same basis as yours, ie it will serve the newly cached file on the next pass, not this one. And then the function at line 265 tinyPngImage() which calls tiny png and generates the image.

I also refactored the checking of the cache directory existing so i wasn't duplicating that code.

I'm working on adding pngquant support at the moment also so i'll submit that after this if you're happy.

Let me know what you think.

Cheers,
Dan