-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: GDHandler
make WebP
with option quality
#7506
Conversation
Isn't this an enhancement? |
Thanks for correct |
GDHandler
make WebP
with option qualityGDHandler
make WebP
with option quality
Add this enhancement in the changelog 4.4.0 to let devs know. |
Thank you for updates. We are close to merge. |
@@ -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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR changes the default quality from -1 to 90.
https://www.php.net/manual/en/function.imagewebp.php#refsect1-function.imagewebp-description
I don't know what -1 means.
Does this degrade the image quality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably the same as in imagejpeg()
- https://www.php.net/manual/en/function.imagejpeg.php
The default (-1) uses the default IJG quality value (about 75).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it appears to be a fixed value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the behavior changes (80 -> 90), should we add this to changelog?
This doesn't seem to destroy the application, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must change default $quality to 80, And i can set parameter $quality to PNG with 0 - 9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that the default quality for webp is 80, for jpeg is 90?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stay with 90 as the default value for quality. Having a separate value for WEBP makes not much sense to me.
Regarding PNG, we can't speak about the quality since these files are lossless. The image quality, as we know it from JPEG or WEBP, will not be changed. Only the compression - file size will be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its okay, i agree to $quality
to WebP
using default 90. And with this changes make developer have preferences to changes quality compression for WebP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddevsr This changes the default quality for webp from 80 to 90.
Can you add it in https://github.com/codeigniter4/CodeIgniter4/blob/4.4/user_guide_src/source/changelogs/v4.4.0.rst#changes ?
Co-authored-by: kenjis <[email protected]>
@ddevsr Thank you! |
Description
With condition of SEO Strategic, we need compress all image web with
WebP
for speed performance.Checklist: