Yahoo! YSlow Smush.itThe performance (loading speed and bytes sent) of a website can be optimized using Yahoo’s API “Smush.it” by optimizing images in several losless ways:

  • stripping meta data from JPEGs
  • optimizing JPEG compression
  • converting certain GIFs to indexed PNGs
  • stripping the un-used colours from indexed images

The WordPress plugin “WP Smush.it” does an awesome job by automating this process and offering a bulk action to smush all images. Unfortunately the Yahoo service isn’t very reliable nor fast, and that’s an understatement.

A lot of users are experiencing delays causing the plugin to be disabled. The following error is thrown:

Automatic smushing has been disabled temporarily due to an error. Operation timed out after 20000 milliseconds with 0 bytes received

Timeout

I found out that the delay of 20 seconds is not enough 90% of the cases. After increasing the timeout to 180 seconds (3 minutes) the automatic smushing didn’t got disabled anymore (after 6 months testing).

Currently there’s no setting in the WordPress plugin to change the timeout, I’ve contacted the author and requested this feature. For now you need to edit the file wp-content/plugins/wp-smushit/wp-smushit.php and change the timeout in line 280 from 20 seconds to 180 seconds.


Edit WordPress plugin - WP Smush.it

Original:

    $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 20));

Example:

    $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 180));

 

Keep in mind that increasing the timeout could delay the process of smushing the images and therefor uploading your article.

Smush.it - reduced by

10 Reacties

  1. Hi,

    Is it also possible to change this rule with functions.php so this change stays available also when there is new version of smush.it?

    Kind regards,

    Willem

    1. Hi Willem,

      Unfortunately I don’t see how this can be implemented in funcions.php, the timeout is directly in the wp_remote_get.

      You could alter the wp_remote_get function and force a longer timeout, but I would seriously discourage anyone to do that. It would affect all functions that use this function.

      Let’s hope the author increases the timeout in the next release and/or make it configurable.

      Cheers,
      Ingmar

  2. Update 12 march 2013

    Yesterday the author updated the plugin to version 1.6.1, the changelog only states “no longer maintained notice”. The proposed solution was not implemented.

      1. Version 1.6.3 has a minor bug causing “Error posting to Smush.it” for new images.

        This is easily solved by removing the following code on line #330 in wp-smushit.php:

        $data = FALSE;

  3. Looks like the maximum value that can be set via Settings/Media is 60. Higher values are changed to 60 on save.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.

nl_NLNederlands