From 13abe4d61233848fb64f17fbc8528bb4245d6e93 Mon Sep 17 00:00:00 2001 From: Youchen Lee Date: Sat, 21 Oct 2017 02:56:52 +0800 Subject: [PATCH] #447 Fix for animated gif upload. (Treat "gif" and "svg" as normal files) / Image quality should remain 100% by default. --- src/controllers/UploadController.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/controllers/UploadController.php b/src/controllers/UploadController.php index 3060a1ab..397192da 100644 --- a/src/controllers/UploadController.php +++ b/src/controllers/UploadController.php @@ -66,19 +66,17 @@ private function proceedSingleUpload($file) event(new ImageIsUploading($new_file_path)); try { - if (parent::fileIsImage($file)) { - // File is an image - // Process & compress the image + if (parent::fileIsImage($file) && !in_array($file->getMimeType(), ['image/gif', 'image/svg+xml'])) { + // Handle image rotation Image::make($file->getRealPath()) ->orientate() //Apply orientation from exif data - ->save($new_file_path, 90); + ->save($new_file_path); // Generate a thumbnail if (parent::imageShouldHaveThumb($file)) { $this->makeThumb($new_filename); } } else { - // File is not an image // Create (move) the file File::move($file->getRealPath(), $new_file_path); }