Add missing filesize update after image rotation
authorMatthias Schmidt <gravatronics@live.com>
Tue, 21 Apr 2015 17:08:02 +0000 (19:08 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 21 Apr 2015 17:08:13 +0000 (19:08 +0200)
wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php

index 863c29d7d5d74c8bc604e5a9baa0c21d702cbf2f..7e0c53160ed314d8798d7572afa3122409be93b7 100644 (file)
@@ -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());
                                                        }
                                                }
                                        }