Created
November 18, 2011 02:03
-
-
Save themasch/1375325 to your computer and use it in GitHub Desktop.
rotate an image to the correct orientation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$exif = (int)$image->getImageProperty("exif:Orientation"); | |
switch($exif) { | |
case 2: | |
$image->flopImage(); | |
break; | |
case 3: | |
$image->rotateImage('black', 180); | |
break; | |
case 4: | |
$image->flipImage(); | |
break; | |
case 5: | |
$image->transposeImage(); | |
break; | |
case 6: | |
$image->rotateImage('black', 90); | |
break; | |
case 7: | |
$image->transverseImage(); | |
break; | |
case 8: | |
$image->rotateImage('black', -90); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment