Re: IMagick confusion - SOLVED but still confused
| From: | Stan | Date: | Sun, 23 Nov 2008 16:51:14 +0000 |
| Subject: | Re: IMagick confusion - SOLVED but still confused | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283717@lists.php.net to get a copy of this message | ||
After messing with this for 2 days I finally got
----------------------------------------------------------------
<?php
$picture = $_GET['PICTURE'];
/* need to get filetype from querystring "picture=" */
header('Content-type: image/jpg');
$image = new IMagick($picture);
$exifArray = $image->getImageProperties("exif:*");
$orientation = $exifArray['exif:Orientation'];
switch($orientation)
{
case imagick::ORIENTATION_TOPLEFT: // this is normal
break;
case imagick::ORIENTATION_TOPRIGHT:
break;
case imagick::ORIENTATION_BOTTOMRIGHT:
break;
case imagick::ORIENTATION_BOTTOMLEFT:
break;
case imagick::ORIENTATION_LEFTTOP:
break;
case imagick::ORIENTATION_RIGHTTOP:
$image->rotateImage("tan", 90);
break;
case imagick::ORIENTATION_RIGHTBOTTOM:
break;
case imagick::ORIENTATION_LEFTBOTTOM:
$image->rotateImage("tan", -90);
break;
case imagick::ORIENTATION_UNDEFINED:
default:
break;
}
echo $image;
?>
----------------------------------------------------------------
to return an upright picture in response to
----------------------------------------------------------------
<img class="framed" src="Picture.php?PICTURE=some.jpg"
border="0">
----------------------------------------------------------------
I'm not sure why
----------------------------------------------------------------
$orientation = $image->getImageProperty("exif:Orientation");
----------------------------------------------------------------
would not work with everything else the same.
Thanks,
Stan