Some logic fixes. Don't strip exif twice.

This commit is contained in:
Michael Foster 2013-08-04 00:54:27 -04:00
parent 0387ae1b46
commit a2b432cfb0

View File

@ -459,9 +459,11 @@ if (isset($_POST['delete'])) {
$error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . $error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($upload) . ' ' . escapeshellarg($upload) . ' ' .
ImageConvert::jpeg_exif_orientation(false, $exif) . ' ' . ImageConvert::jpeg_exif_orientation(false, $exif) . ' ' .
($config['strip_exif'] ? '+profile "*"' : ($config['use_exiftool'] ? '' : '+profile "*"')) . ' ' . ($config['strip_exif'] ? '+profile "*"' :
($config['use_exiftool'] ? '' : '+profile "*"')
) . ' ' .
escapeshellarg($upload)); escapeshellarg($upload));
if ($config['use_exiftool']) { if ($config['use_exiftool'] && !$config['strip_exif']) {
if ($exiftool_error = shell_exec_error( if ($exiftool_error = shell_exec_error(
'exiftool -q -orientation=1 -n ' . escapeshellarg($upload))) 'exiftool -q -orientation=1 -n ' . escapeshellarg($upload)))
error('exiftool failed!', null, $exiftool_error); error('exiftool failed!', null, $exiftool_error);
@ -476,6 +478,8 @@ if (isset($_POST['delete'])) {
if ($error) if ($error)
error('Could not auto-orient image!', null, $error); error('Could not auto-orient image!', null, $error);
$size = @getimagesize($upload); $size = @getimagesize($upload);
if ($config['strip_exif'])
$post['exif_stripped'] = true;
} }
} }
} }
@ -522,7 +526,7 @@ if (isset($_POST['delete'])) {
$thumb->_destroy(); $thumb->_destroy();
} }
if ($config['redraw_image'] || ($config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) { if ($config['redraw_image'] || (!@$post['exif_stripped'] && $config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) {
if (!$config['redraw_image'] && $config['use_exiftool']) { if (!$config['redraw_image'] && $config['use_exiftool']) {
if($error = shell_exec_error('exiftool -q -all= ' . escapeshellarg($upload))) if($error = shell_exec_error('exiftool -q -all= ' . escapeshellarg($upload)))
error('Could not strip EXIF metadata!', null, $error); error('Could not strip EXIF metadata!', null, $error);