From 1f37ddb73958bdc8a1ca56f013580364823166bf Mon Sep 17 00:00:00 2001 From: Len van Essen Date: Fri, 19 Apr 2024 17:22:47 +0200 Subject: [PATCH] Add default image quality --- CHANGELOG.md | 4 ++++ src/CloudflareImageTransforms.php | 6 ------ src/ImageTransformer.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4024cc7..5531a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Release Notes for Cloudflare Image Transforms +## 1.0.1 +- Add default image quality +- Cleanup + ## 1.0.0 - Initial release diff --git a/src/CloudflareImageTransforms.php b/src/CloudflareImageTransforms.php index a05cd1c..68362a3 100644 --- a/src/CloudflareImageTransforms.php +++ b/src/CloudflareImageTransforms.php @@ -59,10 +59,4 @@ protected function settingsHtml(): ?string 'settings' => $this->getSettings(), ]); } - - private function attachEventHandlers(): void - { - // Register event handlers here ... - // (see https://craftcms.com/docs/4.x/extend/events.html to get started) - } } diff --git a/src/ImageTransformer.php b/src/ImageTransformer.php index da90fff..ffac895 100644 --- a/src/ImageTransformer.php +++ b/src/ImageTransformer.php @@ -71,7 +71,7 @@ public function buildTransformParams(ImageTransform $imageTransform): Collection return Collection::make([ 'width' => $imageTransform->width, 'height' => $imageTransform->height, - 'quality' => $imageTransform->quality, + 'quality' => $imageTransform->quality ?: Craft::$app->getConfig()->general->defaultImageQuality, 'format' => $this->getFormatValue($imageTransform), 'fit' => $this->getFitValue($imageTransform), 'background' => $this->getBackgroundValue($imageTransform),