Can't auto-orient a non-JPEG

This commit is contained in:
Michael Foster 2013-08-03 22:20:39 -04:00
parent de62cced6f
commit 3d2de07a1f

View File

@ -325,8 +325,10 @@ class ImageConvert extends ImageBase {
escapeshellarg($this->temp))) || !file_exists($this->temp)) escapeshellarg($this->temp))) || !file_exists($this->temp))
error('Failed to resize image!', null, $error); error('Failed to resize image!', null, $error);
} else { } else {
if ($config['convert_manual_orient']) if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']); $convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else else
$convert_args = &$config['convert_args']; $convert_args = &$config['convert_args'];
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
@ -344,8 +346,10 @@ class ImageConvert extends ImageBase {
} }
} }
} else { } else {
if ($config['convert_manual_orient']) if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']); $convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else else
$convert_args = &$config['convert_args']; $convert_args = &$config['convert_args'];
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .