Image optimizing WordPress plugin

I recently stumbled on the WP Smush.it plugin. It is a neat plugin that takes your images and automatically uploads them to the Smush.it web service so that your images are always nice and optimized. The problems with it are: A) it uploads all your images to a third party, which is slow and clumsy, B) it makes your images subject to the privacy policy and terms of service of Smush.it, which is often undesirable, and C) it can be slow if you have a pile of images to optimize.

So I created a derivative of WP Smush.it that runs entirely on your local server using littleutils (which I blogged about previously).

CW Image Optimizer (available from the WordPress plugin site) works just like WP Smush.it except it never uploads your images to a third party. Images are automatically and losslessly optimized using the opt-png, opt-jpg, and opt-gif programs provided by littleutils.

The downside is it requires Linux and littleutils, which most people won’t have unless they put forth the effort to install them. I plan on creating some step-by-step installation instructions for common Linux distributions in the near future, but in the meantime I have a great plugin to use on all my blogs, and because it is in the WordPress repo, I can easily push updates to all my blogs.

Anyways, if you use it, let me know what you think. I’m excited about actively developing this app to make it a great tool for everyone.

10 comments

  1. Given all the recent problem with Smush.it I was excited to see your new plugin appear. I have root access to our own CentOS server and believe I have your plugin installed correctly and supportive utilities installed. However, upon image upload I’m receiving:

    Fatal error: Call to undefined function mime_content_type() in /home3/pp110726/public_html/wp-content/plugins/cw-image-optimizer/cw-image-optimizer.php on line 169

    The image file I’m testing with JPG.

    Thanks in advance for any assistance you can provide.

  2. As a quick follow up, it appears that the PHP mime_content_type function has been deprecated…

    http://php.net/manual/en/function.mime-content-type.php

    …in favor of “PECL extension Fileinfo”.

    Please advise.

    • mime_content_type() has been deprecated but is still a working function. I chose to use it instead of the PECL extension because the PECL extension is a pain to install.

      I’ve never worked with a server that didn’t have mime_content_type(), so I made the apparently bad assumption that everyone had it. I’ve added another method of MIME detection to the plugin. I also check to make sure the functions I’m using are available before trying to use them now.

      The new version (1.1.3) should be available at WordPress.org within the next 15 minutes or so.

      Please let me know if you run into any other problems, or if the new version still isn’t working for you.

  3. What responsive support, and for free software, no less. Thank you.

    I just upgraded to 1.1.3, but I’m seeing this when trying to upload a JPG:

    Fatal error: Call to undefined function mime_content_type() in /home3/pp110726/public_html/wp-content/plugins/cw-image-optimizer/cw-image-optimizer.php on line 180

    • Thanks for providing the line number. Looks like I missed removing a reference to mime_content_type().

      I’ve fixed the issue in v1.1.4, which should be available in a few minutes at WordPress.org.

  4. Much appreciated — working well — WAY better than the WP Smush.it plugin.

    Ran the Bulk Optimize process against 762 units on a large blog of ours and it worked fairly well. While we received some…

    Warning: Invalid argument supplied for foreach() in /home/hn070118/public_html/blog/wp-content/plugins/cw-image-optimizer/bulk.php on line 33

    …responses, yours is the first image optimization plugin we’ve found that doesn’t eventually timeout.

    Thanks, again.

    • Glad it is working out for you!

      The warning you were receiving was showing up because some of your images only had one size (as opposed to most images that have a small, medium, large, etc size). The code was trying to loop through all the additional image sizes but there weren’t any, so it displayed an error. I’ve added code to 1.1.5 so it will check if additional image sizes exist before trying to do anything with them.

      Thanks again for providing the feedback.

  5. I am using a shared linux hosting plan with Godaddy. Can anyone direct me how I could go about setting up littleutils?

    Thanks so much!
    Tommy

    • GoDaddy probably won’t let you install your own software on a shared hosting plan. You could try asking them, but it definitely isn’t something you can do on your own.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>