Created
January 16, 2018 08:02
-
-
Save dspaudio/89174a9afbd18a1a70e9bb43bf2075f8 to your computer and use it in GitHub Desktop.
This file contains 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
//read EXIF header from uploaded file | |
$exif = exif_read_data($_FILES['ImageFile']['tmp_name']); | |
//fix the Orientation if EXIF data exist | |
if(!empty($exif['Orientation'])) { | |
switch($exif['Orientation']) { | |
case 8: | |
$createdImage = imagerotate($image,90,0); | |
break; | |
case 3: | |
$createdImage = imagerotate($image,180,0); | |
break; | |
case 6: | |
$createdImage = imagerotate($image,-90,0); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment