• Resolved Milan Dinić

    (@dimadin)


    If you smush large image (eg. over 900KB), you can get error “Operation timed out after 5000 milliseconds with 0 bytes received”. Problem is that WordPress by default timeouts after 5 seconds while doing HTTP requests.

    To fix this issue we need to simply add filter which increases timeout period.

    First we need function:

    function wp_smushit_filter_timeout_time($time) {
    	$time = 25; //new number of seconds
    	return $time;
    }

    Then we need to call this function via add_filter. I added this in function wp_smushit_post below $data = false; so that this filter is used only in WP smush.it:
    add_filter( 'http_request_timeout', 'wp_smushit_filter_timeout_time');

    Another thing to consider would be adding of function set_time_limit which would increase time script runs. It can be added above $data = wp_smushit_post($file_url);.

    http://wordpress.org/extend/plugins/wp-smushit/

Viewing 5 replies - 1 through 5 (of 5 total)
  • That worked great. Thanks!

    Have you thought about adopting WP Smush.it or creating a fork that will include these updates that you’re making? It appears like the original author has abandoned it.

    Thread Starter Milan Dinić

    (@dimadin)

    No, I hope that Alex will update plugin with those fixes. Maybe he just doesn’t have time now.

    That worked! Thank you dimadin!

    Plugin Contributor Alex Dunae

    (@alexdunae)

    Thanks Milan — your fix will be in the update released today.

    Pressing the Smush.it button in media library returns the

    Operation timed out after 25000 milliseconds with 0 bytes received

    Using Smush.It Version 1.3.5

    with wordpress 3.2

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP Smush.it] Fix for timeouts after 5000 milliseconds’ is closed to new replies.