Warning: magickwriteimage() expects parameter 1

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
jryans55

Warning: magickwriteimage() expects parameter 1

Post by jryans55 »

This error suddenly appeared last Friday. It has been working fine and Now:
Warning: magickwriteimage() expects parameter 1 to be resource, boolean given

Here's the code I use:

// Invoke ImageMagick
$image = NewMagickWand();
MagickReadImage($image, $upload_dir . '/' . $filename);

// Generate the full size image
$image = MagickTransformImage($image, '0x0', '500x500');
MagickWriteImage($image, $upload_dir . '/' . $filename);


Has anyone seen this error? Any help is appreciated!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Warning: magickwriteimage() expects parameter 1

Post by magick »

Check for exceptions. Chances are the image is not being read so subsequent API calls fails since the image resource is not defined.
jryans55

Re: Warning: magickwriteimage() expects parameter 1

Post by jryans55 »

Thanks for your reply. The resource is defined, then dies for some reason:

// Invoke ImageMagick
$image = NewMagickWand();
MagickReadImage($image, $upload_dir . '/' . $filename);
echo($image); // echoes "Resource#9"
// Generate the full size image
$image = MagickTransformImage($image, '0x0', '500x500'); // dies right here. the resource disappears...
echo($image);// doesn't print out at all
MagickWriteImage($image, $upload_dir . '/' . $filename);
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Warning: magickwriteimage() expects parameter 1

Post by magick »

Hmmm, not sure why its dying. We tried a script similar to yours and it worked without complaint. We're using MagickWand for PHP 1.0.7 and ImageMagick 6.6.2-6.
jryans55

Re: Warning: magickwriteimage() expects parameter 1

Post by jryans55 »

odd...
I'm using the following:

magickWand version: 1.0.7

ImageMagick version: 6.4.2 08/14/08 Q16
Post Reply