From f48e408be1220254f906272d05c498e9fe858cb0 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Wed, 17 May 2023 16:28:08 +0700 Subject: [PATCH 1/7] refactor: GDHandler make WebP with option quality --- system/Images/Handlers/GDHandler.php | 2 +- user_guide_src/source/libraries/images.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 6063ef94496b..0647b91adc96 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -267,7 +267,7 @@ public function save(?string $target = null, int $quality = 90): bool throw ImageException::forInvalidImageCreate(lang('Images.webpNotSupported')); } - if (! @imagewebp($this->resource, $target)) { + if (! @imagewebp($this->resource, $target, $quality)) { throw ImageException::forSaveFailed(); } break; diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index 8c4ed8c7b711..88ed427f7d9c 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -85,7 +85,7 @@ Image Quality ``save()`` can take an additional parameter ``$quality`` to alter the resulting image quality. Values range from 0 to 100 with 90 being the framework default. This parameter -only applies to JPEG images and will be ignored otherwise: +only applies to JPEG and WEBP images and will be ignored otherwise: .. literalinclude:: images/005.php From 01d1b4471059f2465d643d77efd841d818898cc3 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Wed, 17 May 2023 16:35:40 +0700 Subject: [PATCH 2/7] docs: correction words --- user_guide_src/source/libraries/images.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index 88ed427f7d9c..e60336e16db7 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -85,7 +85,7 @@ Image Quality ``save()`` can take an additional parameter ``$quality`` to alter the resulting image quality. Values range from 0 to 100 with 90 being the framework default. This parameter -only applies to JPEG and WEBP images and will be ignored otherwise: +only applies to JPEG and WEBP images, will be ignored otherwise: .. literalinclude:: images/005.php From add72ab3659caec77624da184cbae76467cc078a Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 18 May 2023 08:22:20 +0700 Subject: [PATCH 3/7] docs: added about WebP quality --- user_guide_src/source/changelogs/v4.4.0.rst | 1 + user_guide_src/source/libraries/images.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 652f4f03c579..1b0cfe4fc2b3 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -87,6 +87,7 @@ Libraries - **Validation:** Added ``Validation::getValidated()`` method that gets the actual validated data. See :ref:`validation-getting-validated-data` for details. +- **Images:** Now WebP images can be used option ``$quality`` for compression Helpers and Functions ===================== diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index e60336e16db7..ae4a8c87c66c 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -87,6 +87,8 @@ Image Quality quality. Values range from 0 to 100 with 90 being the framework default. This parameter only applies to JPEG and WEBP images, will be ignored otherwise: +.. note:: Parameter ``$quality`` for WebP can be used since ``v4.4.0`` + .. literalinclude:: images/005.php .. note:: Higher quality will result in larger file sizes. See also https://www.php.net/manual/en/function.imagejpeg.php From 9ba320fcbe5f0d190d1623223c6cf659363ff2f1 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 18 May 2023 08:23:19 +0700 Subject: [PATCH 4/7] docs: added about WebP quality --- user_guide_src/source/changelogs/v4.4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 1b0cfe4fc2b3..a79ba4480764 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -87,7 +87,7 @@ Libraries - **Validation:** Added ``Validation::getValidated()`` method that gets the actual validated data. See :ref:`validation-getting-validated-data` for details. -- **Images:** Now WebP images can be used option ``$quality`` for compression +- **Images:** Now WebP images can be used option ``$quality`` for compression. Helpers and Functions ===================== From cf512475be0ee19ab14438f7b135eddc20ed91cf Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 18 May 2023 16:18:52 +0700 Subject: [PATCH 5/7] docs: correction note --- user_guide_src/source/changelogs/v4.4.0.rst | 2 +- user_guide_src/source/libraries/images.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index a79ba4480764..435022e49bbe 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -87,7 +87,7 @@ Libraries - **Validation:** Added ``Validation::getValidated()`` method that gets the actual validated data. See :ref:`validation-getting-validated-data` for details. -- **Images:** Now WebP images can be used option ``$quality`` for compression. +- **Images:** The option ``$quality`` can now be used to compress WebP images. Helpers and Functions ===================== diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index ae4a8c87c66c..0507c5d36529 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -87,7 +87,7 @@ Image Quality quality. Values range from 0 to 100 with 90 being the framework default. This parameter only applies to JPEG and WEBP images, will be ignored otherwise: -.. note:: Parameter ``$quality`` for WebP can be used since ``v4.4.0`` +.. note:: The parameter ``$quality`` for WebP can be used since v4.4.0. .. literalinclude:: images/005.php From 4c928c130bee9b35245b8e1ac3dcf7b7e6bc15dd Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 25 May 2023 08:21:26 +0700 Subject: [PATCH 6/7] docs: added changes in changelog --- user_guide_src/source/changelogs/v4.4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 435022e49bbe..dfd5497f0ee4 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -120,6 +120,7 @@ Message Changes Changes ******* +- **Images:** Since ``v4.4`` quality WebP not using default PHP. - **Config:** The deprecated Cookie items in **app/Config/App.php** has been removed. - **Config:** Routing settings have been moved to **app/Config/Routing.php** config file. See :ref:`Upgrading Guide `. From 964a5044ffe8f5c13ebd6127f89c90fa5601f43d Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Thu, 25 May 2023 14:15:52 +0700 Subject: [PATCH 7/7] Update user_guide_src/source/changelogs/v4.4.0.rst Co-authored-by: kenjis --- user_guide_src/source/changelogs/v4.4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index dfd5497f0ee4..c0277d6d704b 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -120,7 +120,7 @@ Message Changes Changes ******* -- **Images:** Since ``v4.4`` quality WebP not using default PHP. +- **Images:** The default quality for WebP in ``GDHandler`` has been changed from 80 to 90. - **Config:** The deprecated Cookie items in **app/Config/App.php** has been removed. - **Config:** Routing settings have been moved to **app/Config/Routing.php** config file. See :ref:`Upgrading Guide `.