The 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:
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.
$response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 20));
$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.