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/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index ebfa65ede545..931f82fe0a89 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:** The option ``$quality`` can now be used to compress WebP images. Helpers and Functions ===================== @@ -119,6 +120,7 @@ Message Changes Changes ******* +- **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 `. diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index 8c4ed8c7b711..0507c5d36529 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -85,7 +85,9 @@ 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, will be ignored otherwise: + +.. note:: The parameter ``$quality`` for WebP can be used since v4.4.0. .. literalinclude:: images/005.php