From ac4306555bf3bce78401918e23b81e863fcd37fb Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 22:14:25 -0400 Subject: Fix for instances with old GraphicsMagick or ImageMagick versions (no -auto-orient). --- post.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'post.php') diff --git a/post.php b/post.php index 3c3d6e62..c355eca6 100644 --- a/post.php +++ b/post.php @@ -455,8 +455,16 @@ if (isset($_POST['delete'])) { $exif = exif_read_data($upload); $gm = in_array($config['thumb_method'], array('gm', 'gm+gifsicle')); if (isset($exif['Orientation']) && $exif['Orientation'] != 1) { - if($error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . - escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload))) + if ($config['convert_manual_orient']) { + $error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . + escapeshellarg($upload) . ' ' . + ImageConvert::jpeg_exif_orientation(false, $exif) . ' +profile "*" ' . + escapeshellarg($upload)); + } else { + $error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . + escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload)); + } + if ($error) error('Could not auto-orient image!', null, $error); $size = @getimagesize($upload); } -- cgit v1.3