From 816b593aa1fb9847fe88870a14589558091e54e1 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/post.php b/post.php index f794d917..38270c17 100644 --- a/post.php +++ b/post.php @@ -1092,8 +1092,13 @@ function handle_post(){ 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']))) + escapeshellarg($file['tmp_name']))) { error(_('Could not strip EXIF metadata!'), null, $error); + } else { + clearstatcache(true, $file['tmp_name']); + if (($newfilesize = filesize($file['tmp_name'])) !== false) + $file['size'] = $newfilesize; + } } else { $image->to($file['file']); $dont_copy_file = true;