From 2f2daaaea1d0469e671ec9583320ccdf76b077d4 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 21 Apr 2015 19:08:02 +0200 Subject: [PATCH] Add missing filesize update after image rotation --- .../lib/data/attachment/AttachmentAction.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 863c29d7d5..7e0c53160e 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -206,18 +206,21 @@ class AttachmentAction extends AbstractDatabaseObjectAction { if ($newImage !== null) { $adapter->load($newImage, $adapter->getType()); - - // update width and height of the attachment + } + + $adapter->writeImage($attachment->getLocation()); + + if ($newImage !== null) { + // update width, height and filesize of the attachment if ($orientation == ExifUtil::ORIENTATION_90_ROTATE || $orientation == ExifUtil::ORIENTATION_270_ROTATE) { $attachmentEditor = new AttachmentEditor($attachment); $attachmentEditor->update(array( 'height' => $attachment->width, - 'width' => $attachment->height + 'width' => $attachment->height, + 'filesize' => filesize($attachment->getLocation()) )); } } - - $adapter->writeImage($attachment->getLocation()); } } } -- 2.20.1