diff options
author | Cyrill von Wattenwyl <cvw@adfinis.com> | 2014-09-02 11:20:52 +0200 |
---|---|---|
committer | Cyrill von Wattenwyl <cvw@adfinis.com> | 2014-09-02 11:20:52 +0200 |
commit | 11a40dd1fef6c5b78b054617caba4325f95ee386 (patch) | |
tree | de2e1d7efd6423ef4d1256dd5c90a972ad172719 /program/lib/Roundcube/rcube_image.php | |
parent | 187fd666aa2f32dedfe544d69b7cb213698197f2 (diff) | |
parent | ba084313bfc9c7a5a83e0611fe4376543cc1653d (diff) |
Merge branch 'master' of https://github.com/roundcube/roundcubemail
Conflicts:
plugins/password/config.inc.php.dist
Diffstat (limited to 'program/lib/Roundcube/rcube_image.php')
-rw-r--r-- | program/lib/Roundcube/rcube_image.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php index a15368a7e..d0d0c7437 100644 --- a/program/lib/Roundcube/rcube_image.php +++ b/program/lib/Roundcube/rcube_image.php @@ -189,7 +189,7 @@ class rcube_image } else if($props['gd_type'] == IMAGETYPE_GIF && function_exists('imagecreatefromgif')) { $image = imagecreatefromgif($this->image_file); - $type = 'gid'; + $type = 'gif'; } else if($props['gd_type'] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')) { $image = imagecreatefrompng($this->image_file); @@ -228,6 +228,24 @@ class rcube_image imagecopyresampled($new_image, $image, 0, 0, 0, 0, $width, $height, $props['width'], $props['height']); $image = $new_image; + // fix rotation of image if EXIF data exists and specifies rotation (GD strips the EXIF data) + if ($this->image_file && function_exists('exif_read_data')) { + $exif = exif_read_data($this->image_file); + if ($exif && $exif['Orientation']) { + switch ($exif['Orientation']) { + case 3: + $image = imagerotate($image, 180, 0); + break; + case 6: + $image = imagerotate($image, -90, 0); + break; + case 8: + $image = imagerotate($image, 90, 0); + break; + } + } + } + if ($props['gd_type'] == IMAGETYPE_JPEG) { $result = imagejpeg($image, $filename, 75); } |