From 0cefa9353bd6641641f5c7e7d4c7712712056d4a Mon Sep 17 00:00:00 2001 From: discomrade <83621080+discomrade@users.noreply.github.com> Date: Tue, 6 Jul 2021 11:37:54 +0000 Subject: [PATCH] Recalculate filesize after stripping metadata --- post.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/post.php b/post.php index ebc2dfb1..420a45b8 100644 --- a/post.php +++ b/post.php @@ -1089,9 +1089,17 @@ if (isset($_POST['delete'])) { if ($config['redraw_image'] || (!@$file['exif_stripped'] && $config['strip_exif'] && ($file['extension'] == 'jpg' || $file['extension'] == 'jpeg'))) { if (!$config['redraw_image'] && $config['use_exiftool']) { - if($error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' . - escapeshellarg($file['tmp_name']))) + if ($error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' . + escapeshellarg($file['tmp_name']))) { error(_('Could not strip EXIF metadata!'), null, $error); + } else { + clearstatcache(true, $file['tmp_name']); + $ret = filesize($file['tmp_name']); + if ($ret === false) { + error(_('Could not calculate file size!'), null, $error); + } + $file['size'] = $ret; + } } else { $image->to($file['file']); $dont_copy_file = true;