MagickGetImageWidth returns false

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
MGSteve

Re: MagickGetImageWidth returns false

Post by MGSteve »

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...

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';
?>
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.
Post Reply