Skip to content

Instantly share code, notes, and snippets.

@themasch
Created November 18, 2011 02:03
Show Gist options
  • Save themasch/1375325 to your computer and use it in GitHub Desktop.
Save themasch/1375325 to your computer and use it in GitHub Desktop.
rotate an image to the correct orientation
$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