backtrack

This is the origin story of the EWWW Image Optimizer, a project/plugin that has become my full-time work and recorded here for posterity…

It all started when I was on a quest to find an Image Optimizer plugin. I found two that looked pretty good: WP Smush.it and CW Image Optimizer. WP Smush.it has file size limitations, is a bit slow, and some people have an issue with their images being sent to Yahoo’s servers (even if Yahoo states they only store them temporarily). In practice, I didn’t care about the privacy issues, but I did have technical problems using WP Smush.it and only got it to work about 75% of the time. Yahoo would later discontinue the Smush API, but it was eventually resurrected by a new company long after all this happened. So it was down to CW Image Optimizer, and then I discovered it used littleutils for optimization. I’m on shared hosting, and it wasn’t installed. I looked around the littleutils site hoping for precompiled binaries, but found nothing. Then I looked at the dependency list, and it was long. Some of them would already be on my shared host, but I quickly discovered two that weren’t: pngcrush, and gifsicle. These are the programs that littleutils uses ‘under the hood’ to optimize PNGs and GIFs. It uses jpegtran for JPGs, which my host did have. This created two problems:

  1. I would need to compile several programs before I could even start on littleutils, and then I would need to install them in my /home folder  since I’m on shared hosting. Once I had those compiled, I would have to figure out how to tell littleutils where I had put all the dependencies, since they wouldn’t be in the usual places. Not fun.
  2. Then, once I had compiled littleutils, it would still be in my /home folder. Uh-oh, CW Image Optimizer doesn’t let me tell it where I’ve installed the utilities. Bummer.

I had two possible solutions to my two problems:

  1. Compile everything, and then hack the CW Image Optimizer plugin with the appropriate paths. This would unfortunately render it impossible to upgrade in the future without re-editing the plugin code, something I try very hard to avoid.
  2. Create a derivative of CW Image Optimizer (since it is GPL3 after all) using the underlying tools that littleutils uses, and allow it to have configurable paths to the binary files of those tools.

I chose option two, because it also allowed me to include some more flexibility in the future. For example, early on, I added an option to keep metadata for JPGs in case that information (comments and EXIF info) is important to you. I also chose optipng for PNG optimization which is a derivative of pngcrush.

Within a week, it had 500 downloads. A surprising (to me) trend that would continue well into the future.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.