IMagick confusion
| From: | Stan | Date: | Sat, 22 Nov 2008 14:13:39 +0000 |
| Subject: | IMagick confusion | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283658@lists.php.net to get a copy of this message | ||
This code (invoked by an IMG tag on a page) will return the image which is
then displayed:
----------------------------------------------------------------------------
----------------
<?php
$picture = $_GET['PICTURE'];
/* need to get filetype from querystring "picture=" */
header('Content-type: image/jpg');
$image = new IMagick($picture);
echo $image;
?>
----------------------------------------------------------------------------
----------------
... but this code does not (even when the value of $orientation is 1):
----------------------------------------------------------------------------
----------------
<?php
$picture = $_GET['PICTURE'];
/* need to get filetype from querystring "picture=" */
header('Content-type: image/jpg');
$image = new IMagick($picture);
$orientation = $image->getImageProperty("exif:Orientation")
switch($orientation)
{
case 1: /* normal */
break;
case 2: /* mirror */
break;
case 3: /* 180 anti-clockwise */
break;
case 4: /* mirror + 180 anti-clockwise */
break;
case 5: /* mirror + 90 anti-clockwise */
break;
case 6: /* 90 anti-clockwise */
break;
case 7: /* mirror + 270 anti-clockwise */
break;
case 8: /* 270 anti-clockwise */
$image->rotateImage(new ImagickPixel(), 90);
break;
case default:
break;
}
echo $image;
?>
----------------------------------------------------------------------------
----------------
I'm confused. Can someone please shed light on what's happening?
Thanks,
Stan