Skip to content

Commit

Permalink
Fixes 749 orientation (#765)
Browse files Browse the repository at this point in the history
* Add rotate EXIF detection

* cleanup

* cleanup

* cleanup
  • Loading branch information
crossan007 authored and DawoudIO committed Jul 1, 2016
1 parent 70e5cb4 commit 6426a07
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ImageUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@
if (!$foo->processed) {
echo 'error : ' . $foo->error;
}

$exif = exif_read_data($foo->file_dst_pathname);
if ( !empty($exif['Orientation']) ) {
switch ( $exif['Orientation'] ) {
case 3:
$foo->image_rotate = 180;
break;

case 6:
$foo->image_rotate = 90;
break;

case 8:
$foo->image_rotate = 270;
break;
}
}

$foo->file_new_name_body = $finalFileName;
$foo->file_overwrite = true;
$foo->image_resize = true;
Expand Down

0 comments on commit 6426a07

Please sign in to comment.