Support » Plugin: Imsanity » [Imsanity] PHP Error on upload of image

  • Resolved Vikram


    Hi there,

    This is a great plugin, but I can’t get it to work. For the record, I am using WordPress 3.0 on a multisite.

    When I upload an image, the image size is 0 pointing to an error when it tries to convert the image. PHP logs give the following error:

    PHP Warning: rename() expects parameter 1 to be string, object given in [snip]/plugins/imsanity/imsanity.php on line 58

    Hoping for a resolution!


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Jason


    My first guess is that the GD library may not be enabled for PHP on your server.

    However I was not detecting errors correctly in Imsanity. I just updated the plugin to version 1.0.1. If you install this it should give you an error message explaining why the image is unable to be resized.

    If it turns out there is a different error besides the missing GD libraires, it would be great if you can post the error message.

    Hi there.

    Thanks for the update. I installed the updated version of your plugin and I got the error regarding the GD library. So, I went ahead and installed the GD library, but now I get the following error:

    Oh Snap! Imsanity was unable to resize this image for the following reason: ‘File “[snip]/blogs.dir/23/files/2011/07/cro-globe-RH-0711.jpg” is not an image.’

    There is no other error. The file is a valid oversized JPG image.

    Thanks again for the plugin and looking into this.

    Plugin Contributor Jason


    It appears that you installed GD without support for JPG images. (it can be configured to support various image types or not). Here’s some additional info –

    To help with debugging you can use this code snippet below which is basically the same way WordPress loads images. Just edit the path to a test image on your server and run this script (either through your browser or command-line is fine). It will output “OK” or “ERROR”

    $image = imagecreatefromstring( file_get_contents( “/path/to/your/file.jpg” ) );
    echo ( is_resource( $image ) ) ? “OK\n” : “ERROR\n”;

    Excellent. That was it. Recompiling PHP with GD support and JPG image did the trick.

    Thanks again!


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Imsanity] PHP Error on upload of image’ is closed to new replies.