CW Image Optimizer
"Unknown type" and "Bad response" (26 posts)

  1. Hi!

    So I'm testing this out. I do not know if littleutils is installed on my shared server, but I thought I'd try it, and I assumed that you rplugin would do a check for it and let me know if it wasn't. As I did not get a warning or message from the plugin, I tried to optimize one image (I tried a png and a jpg). it didn't work.

    For the png, it says "Unknown type: text/plain"

    for the jpg, it says "Bad response from optimizer"

    I guess this means that the littleutils is not installed on my shared server? maybe a quick check somehow would be useful, upon activation of the plugin?



  2. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Thanks for the feedback.

    The latest version, 1.1.1, does check if the required utilities are available and if not it displays a warning message at the top of the admin pages.

    For the PNG error, sounds like your PNG file is either not a valid PNG file, or your installation of PHP is returning the incorrect MIME type for the file.

    littleutils is not a standard package that most servers have. You'll probably need to install it before this plugin will work for you. It takes a little more effort to get going than WP Smush.it, but if you don't want your images uploaded to a third party (I sure don't) then it is worth it.

  3. Thanks for updating the plguin. I had installed it this morning, so good wok on updating it quickly!

    My server doesn't have littleutils installed (confirmed by your plugin), so I've asked my shared host to install it for me.

    As for the MIME types, that's really strange, as they are set correctly as far as I can tell. Anyway, I'll try again once my host installs littleutils. I'll leave this as "not resolved" for now, and I'll update when I can.


  4. So I asked my host to install it, and they did. However, I get this message on my dashboard:

    "CW Image Optimizer requires littleutils. You are missing: opt-png, opt-jpg, opt-gif."

    I asked my host if these were things that needed to be turned on by them or something, and they said the following:

    "Can you specify the path to littleutils? if so, please use /usr/local/lib/littleutils"

    I don't see anywhere in your code a place to specify the path, and to be honest, I'm not even clear on how it is that you actually check for it being installed (I'm intermediate-level in PHP; I read through your code and could follow most of it, but didn't see exactly how you check).

    Also, when I go to my library, beside png files I get "Unsupported file type", and beside jpg files I get "Unsupported file type
    opt-jpg is missing"

    So now what? Any suggestions?


  5. Moogle Stiltzkin
    Posted 4 years ago #

    What is the differences between size reduction and image quality between smush it and this littleutils for linux ?

    Simply put which is better in these 2 areas ?

    Also is there going to be a guide how to install/setup the dependency needed for this plugin ?

  6. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    @richardmtl - littleutils provides several little utilities. The ones required by this plugin are opt-jpg, opt-gif, and opt-png. The plugin expects them to be in the PATH, which is done by default when littleutils is installed.

    @Moogle Stiltzkin - Both this plugin and WP Smush.it provide lossless optimization, meaning the image quality will be exactly the same before and after the optimization.

    However, CW Image Optimizer will often provide smaller file sizes (just a little bit smaller) because it tries more methods of optimization than WP Smush.it.

    I'm working on a guide for installing littleutils on the most common Linux distributions, but it isn't finished yet. Most people familiar with installing software on Linux will be able to do it without, as littleutils follows the standard configure/make/make install pattern of installing software.

    Basically you download package and run the following commands in the directory that has the littleutils-1.0.24.tar.bz2 file:

    1. tar jxvf littleutils-1.0.24.tar.bz2
    2. cd littleutils-1.0.24
    3. ./configure
    4. make
    5. make install
    6. make install-extra

    littleutils itself has a few dependencies, such as gifsicle, pngcrush, and lzma. These are generally available from the package manager used in most Linux distributions. I'll include instructions on installing these in my install guide.

  7. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    The installation instructions have been updated to include step-by-step instructions for CentOS and Ubuntu. Hope this helps!

  8. Hi!

    I gave your PATH instructions to my host, and he sent back the following:

    "Please send this to the developer

    echo $PATH
    /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin::/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin


    So.. now what?

  9. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    The utilities are normally installed in /usr/local/bin, which is listed in the path provided by your host.

    It is possible that the user that PHP is running as on your server doesn't have permission to access or use the opt-jpg/opt-png/opt-gif utilities.

    The other possibility is that your host didn't install littleutil's dependencies, so opt-jpg, opt-png, or opt-gif weren't actually installed. For example, if you are missing pngcrush, then installing littleutils won't install opt-png because opt-png requires pngcrush.

  10. Moogle Stiltzkin
    Posted 4 years ago #

    How would i install this utility thingy for my QNAP ?

    Any ideas o.O; ?

    it's linux.

  11. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    I'm assuming your QNAP is a NAS, in which case, I have no idea how you would install littleutils on it.

    Looks like QNAP runs embedded Linux, which basically means that while it is technically Linux, it is an extremely stripped down version and the bundled packages is going to vary from one device to another. Without having access to the particular model you have, I can't give accurate advice on what you need to do to get littleutils installed properly.

    Sorry I wasn't able to be more help.

  12. So, my host says that everything was installed correctly, including the dependencies etc, and that it's in the PATH. Not sure what else to do at this point. Any other suggestions?

  13. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    My guess is your host hasn't given the web user access to the littleutils binaries. They probably installed as root and are testing as root, so they don't see the issue that the web user doesn't have access to the binaries.

    Other than that, I can't offer much help without having access to the server. Sorry. :(

  14. gavinhamm
    Posted 4 years ago #

    @richardmtl I have the exact same problem as you. I installed everything and I'm getting the -Bad Respone error after bulk optimizing and in the library every image shows

    "Unsupported file type", and beside jpg files I get "Unsupported file type
    opt-jpg is missing"
    no matter the file type.

  15. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    I've modified the latest version (1.1.6) to make it possible to disable the littleutils check. Looks like my method of detecting if it is installed doesn't work on some hosts.

    To disable the check, add the following to your wp-config.php:

    define('CW_IMAGE_OPTIMIZER_SKIP_CHECK', true);

  16. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Making people modify their wp-config.php isn't very user friendly, so I've just pushed 1.1.7. This new version has a settings page that makes it easy to disable the littleutils check by simply checking a box.

  17. I was excited about this update, but it still doesn`t work for me. I get "Bad response from optimizer". I am now officialy sad. My host doesnt know what to do anymore for me. I await your next update anxiously, and hope it'll be the one that works for me.. Thanks for the time you're putting into this (I read your site, seems like you got a lot on your plate!). Good luck! :)

  18. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Hmm. If I could temporarily get access to your site (via FTP and WordPress) then I may be able to troubleshoot the issue. If you are open to this, please contact me.

    Or you could try troubleshooting on your own. You could try modifying line 244 to include the contents of $result. This would show you what the optimizer is returning.

    You may also have to change line 220 to:
    $result = exec($command . ' ' . escapeshellarg($file) . ' 2>&1');

    That will redirect stderr to stdout, in case the optimizer is giving an error message.

  19. Moogle Stiltzkin
    Posted 4 years ago #

    Hi zulu,

    Thought you should know that Alex came up with a good solution for bulk smushing.


    Then again your using an internal utility so probably wouldn't need this fix for your plugin. But thought i should share anyway.

    Zulu if you have time or are willing, maybe we can do a teamviewer session and you can help me setup this little utils using winscp putty via ssh.

  20. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Moogle, this plugin also supports bulk smushing, but doesn't require you to send all your images to a third party service. Using local utilities is much faster.

    Skipping images that are already optimized is a good idea. I'll add that to the next version.

    I haven't found a need for the batching feature. I've run this plugin against websites with thousands of images and haven't had it timeout on me.

    There are installation instructions for CentOS and Ubuntu:

    Are you using a different OS?

  21. ealfert
    Posted 4 years ago #

    First of all, THANKS! for the great plugin... it works great.

    In case it helps anyone, I was also getting "Bad response from optimizer" even after installing littleutils and all the dependencies.

    I looked at Apache error logs and it was saying, "PHP Warning: escapeshellarg() has been disabled for security reasons in /path_to_my_wordpress/public_html/wp-content/plugins/cw-image-optimizer/cw-image-optimizer.php on line 220".

    I had to remove "escapeshellarg" from "disable_functions" in php.ini

    Don't forget to restart php or apache service(s) depending on how you run php code on your server

  22. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Glad you like the plugin, and glad you were able to get it working!

    I'm surprised that escapeshellarg() was on your disabled_functions list. This function makes arguments to shell commands safe by escaping single quotes, and having it disabled poses more of a security risk than having it enabled.

    Thanks for taking the time to post your solution so others can benefit!

  23. heutger
    Posted 4 years ago #


    I enabled the debugging as described above but still got sh: command not found. After creating a php info file, I saw, the exec path is restricted to /usr/bin with default installation of Plesk on CentOS, so standard installation to /usr/local/bin does not work out, either in path or not. So my solution was now to do a ln -s /usr/local/bin/* . inside of /usr/bin and now everything works out.


  24. David Garcia
    Posted 4 years ago #

    Hi all,

    The solution is use the parameter --prefix in the configure script.

    In my case the utils were installed on /usr/local/bin and the apache user didn't had that path inside the PATH environment variable.

    So if you rerun the configure script like this:

    ./configure --prefix=/usr

    It will work like a charm.

    David Seocom Experts Marketing Online

  25. Jacob Allred
    Plugin Author

    Posted 4 years ago #

    Thanks, SultanICQ! I've added this information to the installation instructions (may take some time for WordPress to update the public site).

  26. B_Dark
    Posted 4 years ago #

    how can i install the littleutils in a reseller account?!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • CW Image Optimizer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic