Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP and Imagemagick

Options
  • 26-04-2005 12:15pm
    #1
    Registered Users Posts: 180 ✭✭


    Hi,

    I am getting an error using imagemagick and I cannot figure out where it is going wrong.

    What I am basically doing is uploading an image file from a form and creating a thumbnail and popup image from it. This method has served me well in the past, I have used identical code on previous sites.

    here is my code segment.

    [PHP]

    $current_size = getimagesize("../img/$perm");
    $current_img_width = $current_size[0];
    $current_img_height = $current_size[1];

    $new_img_width = 300;
    $new_img_height = round((($new_img_width / $current_img_width) * $current_img_height));

    $imObj = new ImageMagick($HTTP_POST_FILES);
    $imObj -> setVerbose(FALSE);
    $imObj -> setTargetdir($imgdir);
    $imObj -> Resize($new_img_width,$new_img_height, "fit");
    $imObj -> Convert("jpg");
    $perm = $imObj -> Save('main_');

    $thumbheight = round ( ($new_img_height / 3) );

    $imObj -> Resize(100,$thumbheight, "fit");
    $imObj -> Convert("jpg");
    $thumb = $imObj -> Save('thumb_');
    $imObj -> CleanUp();

    [/PHP]

    $imgdir is declared as an absolute path to the directory for the images

    the error I am getting is ImageMagick: Corrupt image

    I have checked the image copied up by php and it is fine.

    Anyone have any ideas?


Advertisement