summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class13
1 files changed, 13 insertions, 0 deletions
diff --git a/it.class b/it.class
index d18ca4f..262b295 100644
--- a/it.class
+++ b/it.class
@@ -546,6 +546,19 @@ static function imageconvert($p)
list(, $type) = explode(' ', strtolower(it::exec('identify 2>/dev/null {in}', $p))); # for things like eps
}
+ # emulate -auto-orient which is not supported by GM
+ if ($p['-opts']['-auto-orient']) {
+ $exif = @exif_read_data($p['in'], 'IFD0');
+ switch ($exif['Orientation']) {
+ case 2: $p['-opts']['-flop'] = true; break;
+ case 3: $p['-opts']['-rotate'] = 180; break;
+ case 4: $p['-opts']['-flip'] = true; break;
+ case 6: $p['-opts']['-rotate'] = 90; break;
+ case 8: $p['-opts']['-rotate'] = 270; break;
+ }
+ unset($p['-opts']['-auto-orient']);
+ }
+
$type = strtr($type, array("jpeg" => "jpg", "tiff" => "tif", "ps" => "eps", "ept" => "eps"));
$p += array('type' => $type, 'types' => "bmp,eps,gif,jp2,jpg,png,svg,tif");
$p['-opts'] = array('-thumbnail' => $p['size']) + (array)$p['-opts'];