WordPress.org

Ready to get started?Download WordPress

Forums

Imsanity
[resolved] [Imsanity] PHP Error on upload of image (5 posts)

  1. gvix
    Member
    Posted 2 years ago #

    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!

    Vikram

  2. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. gvix
    Member
    Posted 2 years ago #

    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.

  4. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    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 - http://php.net/manual/en/image.installation.php

    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"

    <?php
    $image = imagecreatefromstring( file_get_contents( "/path/to/your/file.jpg" ) );
    echo ( is_resource( $image ) ) ? "OK\n" : "ERROR\n";
    ?>

  5. gvix
    Member
    Posted 2 years ago #

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

    Thanks again!

    Vikram

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags