summaryrefslogtreecommitdiffstats
path: root/lib/private/image.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-18 23:15:52 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-18 23:15:52 +0100
commita28d3b594b089af837c6a319d7b7b6a8f7155210 (patch)
tree57d959cee090a7ac5e5d46789f047cc164ab86fd /lib/private/image.php
parentaff22b32250b6a97136cb25db82e65c4f1148f5c (diff)
downloadnextcloud-server-a28d3b594b089af837c6a319d7b7b6a8f7155210.tar.gz
nextcloud-server-a28d3b594b089af837c6a319d7b7b6a8f7155210.zip
Fix exif orientation for flipped images
fixes #13363 Links: * http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/ * Example data: https://github.com/recurser/exif-orientation-examples
Diffstat (limited to 'lib/private/image.php')
-rw-r--r--lib/private/image.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/image.php b/lib/private/image.php
index 07cfb0f72d3..90b024de3d3 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -358,35 +358,42 @@ class OC_Image {
$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) {