From 55628f1f5659cf84a49a84a356ecf0e9670c2a15 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jun 2016 15:54:41 +0200 Subject: [PATCH] Remove metadata from medium-photos and thumbs + Reduce quality of medium-photos #556 --- php/Modules/Photo.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index 8ec06ba..923fe75 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -314,6 +314,9 @@ final class Photo { $thumb->setImageCompressionQuality($quality); $thumb->setImageFormat('jpeg'); + // Remove metadata to save some bytes + $thumb->stripImage(); + // Copy image for 2nd thumb version $thumb2x = clone $thumb; @@ -394,6 +397,9 @@ final class Photo { // Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); + // Quality of medium-photo + $quality = 90; + // Set to true when creation of medium-photo failed $error = false; @@ -426,6 +432,8 @@ final class Photo { // Adjust image $medium->scaleImage($newWidth, $newHeight, true); + $medium->stripImage(); + $medium->setImageCompressionQuality($quality); // Save image try { $medium->writeImage($newUrl); }