Skip to content

Commit 1858287

Browse files
authored
Add $quality usage for Image Library
1 parent b9cef44 commit 1858287

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

user_guide_src/source/libraries/images.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ starting at the top left corner. The result would be saved as the thumbnail.
8989
while processing images you may need to limit their maximum size, and/or
9090
adjust PHP memory limits.
9191

92+
Image Quality
93+
=============
94+
95+
``save()`` can take an additional parameter ``$quality`` to alter the resulting image
96+
quality. Values range from 0 to 100 with 90 being the framework default. This parameter
97+
only applies to JPEG images and will be ignored otherwise::
98+
99+
$image = Config\Services::image()
100+
->withFile('/path/to/image/mypic.jpg')
101+
->save('/path/to/image/my_low_quality_pic.jpg', 10);
102+
103+
.. note:: Higher quality will result in larger file sizes. See also https://www.php.net/manual/en/function.imagejpeg.php
104+
92105
Processing Methods
93106
==================
94107

0 commit comments

Comments
 (0)