• Resolved Alfo

    (@alfonsberger)


    Hi,

    It seems like the plugin in writing the following error messages in our debug.log after the latest update of the plugin:

    PHP Fatal error: Call to undefined method WP_Error::resize() in /xxxxxxxxxx/wp-content/plugins/wp-retina-2x/wr2x_vt_resize.php on line 24

    Any idea what might cause this?

    Thanks for your help Jordy and the great plugin you have written!

    https://ww.wp.xz.cn/plugins/wp-retina-2x/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hello,

    It’s a weird error but apparently more a problem with the hosting service config or settings. I am not so sure. It’s not a plugin issue because that function exists, it is a standard function. But some people said the problem triggers when you try to work with a huge image…

    I think we don’t know the real error right now. Can add this code in wr2x_vt_resize.php right after $image = wp_get_image_editor( $file_path ); ?

    if ( is_wp_error( $image ) ) {
    			wr2x_log( "Resize failure: " . $result->get_error_message() );
    			error_log( "Resize failure: " . $result->get_error_message() );
    			return null;
    		}

    Then try again, we might see an interesting error in your logs.

    Thread Starter Alfo

    (@alfonsberger)

    Hi Jordy,

    Thanks for your reply. I have added the code, but it seems the there is no new error code in the debug.log. I just get an http-error inside the wordpress-backend if I try to upload a larger file (everything above around 2 MB)

    Best,
    Alfons

    Plugin Author Jordy Meow

    (@tigroumeow)

    I pushed an update, can you try it?

    Thread Starter Alfo

    (@alfonsberger)

    Hi Jordy,

    Thanks for the update. Seems overall I can upload larger files than before. Stil no error in our debug.log, which is of course a good thing, but is it what you want?

    That said I uploaded a ton of variations (different sizes and dimensions) of three different photos. It seems like the limit is everything smaller than 4900×3300 as for the dimension, but it gets weird when it comes to file-size. Some photos in 4900×3300 work with 6.5MB and some only with 3.5MB.

    Hope that helps

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hello Alfons,

    That’s normal, the size doesn’t depend only on the dimension of the photo, it’s more about how compressed it can be. Don’t worry about it šŸ™‚

    Is everything working fine now?

    By the way, to know the limitation of your PHP settings you can see it in the Retina Dashboard, there is a notice like “Your PHP configuration allows uploads of 50MB maximum.”

    Thread Starter Alfo

    (@alfonsberger)

    Hi Jordy,

    Not sure if I understand you correctly and maybe I did not explain it good enough.
    Here is what I have noticed. Photo A and Photo B are both 4900x3300pixel. If I compress both photos to almost exact file size – lets say 4.5 MB – and upload it, one photo works and the other photo gives an error message. This is normal??

    Our PHP configuration allows 40MB uploads. I’m just not sure what I should do with this if I’m not even able to upload a images with more than 6MB.

    Cheers
    Alfons

    Plugin Author Jordy Meow

    (@tigroumeow)

    By the way, are you trying to upload a full-retina image or are you trying to replace the original image?

    Thread Starter Alfo

    (@alfonsberger)

    All uploads are done in the WordPress Media library with “Upload file”

    Thread Starter Alfo

    (@alfonsberger)

    Hi Jordy,
    This is another error message we can find in our log file from the plugin:

    [26-Apr-2015 09:59:34 UTC] PHP Notice:  Undefined variable: result in /xxxxx/wp-content/plugins/wp-retina-2x/wr2x_vt_resize.php on line 23
    [26-Apr-2015 09:59:34 UTC] PHP Fatal error:  Call to a member function get_error_message() on a non-object in /xxxxx/wp-content/plugins/wp-retina-2x/wr2x_vt_resize.php on line 23

    Cheers
    Alfons

    Plugin Author Jordy Meow

    (@tigroumeow)

    Ah yes, sorry, something is wrong in my code. Actually, something might be wrong with your WordPress at this point, it looks like the path of some media file (not related to retina) cannot be found.

    Open the wr2x_vt_resize.php file, change the code to this:

    if ( is_wp_error( $image ) ) {
    	wr2x_log( "Resize failure: " . $image->get_error_message() );
    	error_log( "Resize failure: " . $image->get_error_message() );
    	return null;
    }

    It looks slightly different than yours (from $result to $image). Try it again. There should be a more explicit error.

    Thread Starter Alfo

    (@alfonsberger)

    Hi Jordy,

    Changed it and this is the error message we still receive:

    [14-May-2015 21:01:11 UTC] PHP Notice:  Undefined variable: result in /xxxxxxx/wp-content/plugins/wp-retina-2x/wr2x_vt_resize.php on line 23
    [14-May-2015 21:01:11 UTC] PHP Fatal error:  Call to a member function get_error_message() on a non-object in /xxxxxxx/wp-content/plugins/wp-retina-2x/wr2x_vt_resize.php on line 23

    Cheers
    Alfons

    Plugin Author Jordy Meow

    (@tigroumeow)

    Actually the code is not supposed to be here but I miscode it. Please check again the line 23 and 24. In the new version I wrote $result but it should be $image. Like this:

    if ( is_wp_error( $image ) ) {
    wr2x_log( "Resize failure: " . $image->get_error_message() );
    error_log( "Resize failure: " . $image->get_error_message() );
    return null;
    }

    Can you check and try again?

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘PHP Fatal error after the latest update.’ is closed to new replies.