Page 1 of 1

Warning: magickwriteimage() expects parameter 1

Posted: 2010-06-21T10:01:33-07:00
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!

Re: Warning: magickwriteimage() expects parameter 1

Posted: 2010-06-21T10:34:54-07:00
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.

Re: Warning: magickwriteimage() expects parameter 1

Posted: 2010-06-21T11:01:42-07:00
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);

Re: Warning: magickwriteimage() expects parameter 1

Posted: 2010-06-21T11:39:22-07:00
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.

Re: Warning: magickwriteimage() expects parameter 1

Posted: 2010-06-21T12:25:45-07:00
by jryans55
odd...
I'm using the following:

magickWand version: 1.0.7

ImageMagick version: 6.4.2 08/14/08 Q16