Re: MagickGetImageWidth returns false
Posted: 2009-03-13T08:22:30-07:00
As no-one else seems to reply to threads in here, I thought I would! it may help someone else.
Check the file is loading first - store the result of "MagickReadImage($resource, 'VSBackup/_MG_6005.JPG');" in a variable and check. It may be worth specifying a full path to rule out any issues with that.
Try this...
Also, even though the docs suggest it returns a boolean, mine returned NULL when it failed to open the file! So don't do a check for === false as it will fail the check.
Check the file is loading first - store the result of "MagickReadImage($resource, 'VSBackup/_MG_6005.JPG');" in a variable and check. It may be worth specifying a full path to rule out any issues with that.
Try this...
Code: Select all
<?php
$resource = NewMagickWand();
$openResult = MagickReadImage($resource, 'VSBackup/_MG_6005.JPG');
if ($openResult === true)
{
echo 'Opened OK.<BR>';
$width = MagickGetImageWidth($resource);
echo $width;
}
else
echo 'Failed to open';
?>