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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php