Support » Plugin: RICG Responsive Images » Division by zero error after upgrade to 2.3.0

Viewing 10 replies - 1 through 10 (of 10 total)
  • Note: this warning does not appear anywhere else on the site AFAICS, and the page appears as normal apart from the warning itself. None of the sub-blogs in the folders exhibit any similar behaviour (the site is a single domain sub-folder multisite setup).

    Line 173 is:

    // Calculate the image aspect ratio.
    	$img_ratio = $img_height / $img_width;

    Just want to get rid of that warning!

    I’m having the same problem as well. how do we fix it???

    Plugin Contributor Joe McGill

    (@joemcgill)

    Hi all, thanks for the feedback. We’re looking into the issue and hope to have a fix for you soon.

    – Joe

    Plugin Contributor Joe McGill

    (@joemcgill)

    Can you try pasting this code at line 156 of the wp-tevko-responsie-images.php file and see if this does the trick?

    if ( 0 == $img_width ) {
    	return false;
    }

    Thanks for the update, impressively responsive!
    The code I have at 156 is

    // Get the image meta data.
    	$img_meta = wp_get_attachment_metadata( $id );

    Should you suggested update go before or after this?

    I have to admit that I pasted your code in at 173, replacing this

    // Calculate the image aspect ratio.
    	$img_ratio = $img_height / $img_width;

    and the fix appeared to have worked!

    Sorry for the delay in replying, I’m in Sydney, Australia, so there’s a bit of a time difference!

    Plugin Contributor Joe McGill

    (@joemcgill)

    Sorry, should have been more specific, the code should go right above the first line you pasted in above, like so:

    // Break image data into url, width, and height.
    list( $img_url, $img_width, $img_height ) = $img;
    
    // If we have no width to work with, we should bail (see issue #118).
    if ( 0 == $img_width ) {
    	return false;
    }
    
    // Get the image meta data.
    $img_meta = wp_get_attachment_metadata( $id );

    After reading through the code more carefully (I have limited skills in this area!) I pasted in the code you suggested before the above code:

    // Break image data into url, width, and height.
    	list( $img_url, $img_width, $img_height ) = $img;
    
    	if ( 0 == $img_width ) {
    	return false;
    }
    
    	// Get the image meta data.
    	$img_meta = wp_get_attachment_metadata( $id );

    and all appears to have worked correctly.

    Many thanks for your quick response, and many thanks too for your excellent work in this field; with an image heavy site the work you are doing is very important to us, and we’re following it closely!

    Our posts crossed, glad I guessed right!

    Cheers,

    Tony Page

    Plugin Contributor Joe McGill

    (@joemcgill)

    Thanks for confirming. We’ll be getting this patch into the next update.

    Plugin Contributor Joe McGill

    (@joemcgill)

    Hello again,

    Anyone experiencing this issue should upgrade to 2.3.1, which includes the fix that was outlined above.

    Joe

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Division by zero error after upgrade to 2.3.0’ is closed to new replies.