diff --git a/post.php b/post.php index bd7f798c..05fb731e 100644 --- a/post.php +++ b/post.php @@ -1047,9 +1047,11 @@ if (isset($_POST['delete'])) { if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) { error($config['error']['maxsize']); } + // If, on the basis of the file extension, the image file has metadata we can operate on. + $file_image_has_operable_metadata = $file['extension'] === 'jpg' || $file['extension'] === 'jpeg' || $file['extension'] === 'webp' || $file['extension'] == 'png'; - if ($config['convert_auto_orient'] && ($file['extension'] == 'jpg' || $file['extension'] == 'jpeg')) { + if ($file_image_has_operable_metadata && $config['convert_auto_orient']) { // The following code corrects the image orientation. // Currently only works with the 'convert' option selected but it could easily be expanded to work with the rest if you can be bothered. if (!($config['redraw_image'] || (($config['strip_exif'] && !$config['use_exiftool'])))) { @@ -1113,8 +1115,7 @@ if (isset($_POST['delete'])) { $dont_copy_file = false; - $strippable_image_ext = $file['extension'] === 'jpg' || $file['extension'] === 'jpeg' || $file['extension'] === 'webp' || $file['extension'] == 'png'; - if ($config['redraw_image'] || (!@$file['exif_stripped'] && $config['strip_exif'] && $strippable_image_ext)) { + if ($config['redraw_image'] || ($file_image_has_operable_metadata && !@$file['exif_stripped'] && $config['strip_exif'])) { if (!$config['redraw_image'] && $config['use_exiftool']) { try { $file['size'] = strip_image_metadata($file['tmp_name']);