From 8d02662eb362b59accf40160ec28011bc2845541 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sun, 22 Mar 2020 22:56:53 +0100 Subject: [PATCH] Set JPEG compression to 80 for thumbnails. This saves both disk space and bandwidth by compromising a little on quality. Only thumbnails are affected; full-size images are still saved in full detail. --- models/Thumbnail.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/Thumbnail.php b/models/Thumbnail.php index 22987354..70da00bb 100644 --- a/models/Thumbnail.php +++ b/models/Thumbnail.php @@ -256,6 +256,9 @@ class Thumbnail if (!is_dir(THUMBSDIR . '/' . $this->image->getSubdir())) mkdir(THUMBSDIR . '/' . $this->image->getSubdir(), 0755, true); + // No need to preserve every detail. + $thumb->setImageCompressionQuality(80); + // Save it in a public spot. $thumb->writeImage(THUMBSDIR . '/' . $this->image->getSubdir() . '/' . $thumb_filename);