Skip to content

Commit

Permalink
Merge pull request #13448 from owncloud/fix-exif-orientation
Browse files Browse the repository at this point in the history
Fix exif orientation for flipped images
  • Loading branch information
georgehrke committed Jan 18, 2015
2 parents aff22b3 + a28d3b5 commit 9cef90d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/private/image.php
Expand Up @@ -358,35 +358,42 @@ public function fixOrientation() {
$o = $this->getOrientation();
$this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, array('app' => 'core'));
$rotate = 0;
$flip = false;
switch ($o) {
case -1:
return false; //Nothing to fix
case 1:
$rotate = 0;
break;
case 2: // Not tested
case 2:
$rotate = 0;
$flip = true;
break;
case 3:
$rotate = 180;
break;
case 4: // Not tested
case 4:
$rotate = 180;
$flip = true;
break;
case 5: // Not tested
case 5:
$rotate = 90;
$flip = true;
break;
case 6:
//$rotate = 90;
$rotate = 270;
break;
case 7: // Not tested
case 7:
$rotate = 270;
$flip = true;
break;
case 8:
$rotate = 90;
break;
}
if($flip) {
imageflip($this->resource, IMG_FLIP_HORIZONTAL);
}
if ($rotate) {
$res = imagerotate($this->resource, $rotate, 0);
if ($res) {
Expand Down

0 comments on commit 9cef90d

Please sign in to comment.