-
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f48e408
refactor: GDHandler make WebP with option quality
ddevsr 01d1b44
docs: correction words
ddevsr add72ab
docs: added about WebP quality
ddevsr 9ba320f
docs: added about WebP quality
ddevsr cf51247
docs: correction note
ddevsr 4c928c1
docs: added changes in changelog
ddevsr 964a504
Update user_guide_src/source/changelogs/v4.4.0.rst
ddevsr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.phpThere 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.
80?
https://github.com/php/php-src/blob/8d0345d94ef98bfe29df264b338aeef16ddefda9/ext/gd/libgd/gd_webp.c#L121
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
toWebP
using default 90. And with this changes make developer have preferences to changes quality compression for WebPThere 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 ?