Opened 2 years ago
Closed 2 years ago
#56526 closed defect (bug) (invalid)
Generate WebP for JPEG based on image size
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Follow up to #55443: While the multi MIME type architecture has been reverted, part of that code that came as an iteration to the original proposal was to allow fine tuned control over which image sizes should use WebP vs JPEG.
For the vast majority of sizes, it will make sense to use WebP (e.g. any size that is used in the frontend). However, there are some special cases we need to consider, e.g. sizes that are registered only for a special circumstance, such as usage in an email newsletter or in Open Graph tags, or any other technology that may not support WebP.
This ticket is to track this work, and it is a prerequisite to the already opened #56288, which will be used to control this aspect for custom image sizes in a declarative way.
Change History (9)
This ticket was mentioned in PR #3166 on WordPress/wordpress-develop by felixarntz.
2 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
felixarntz commented on PR #3166:
2 years ago
#4
This should be ready for a comprehensive review (and hopefully commit) now.
felixarntz commented on PR #3166:
2 years ago
#7
Committed in https://core.trac.wordpress.org/changeset/54097.
#8
@
2 years ago
- Keywords needs-dev-note added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for dev note (see https://core.trac.wordpress.org/ticket/55443#comment:196).
This is a work in progress to bring awareness of the image size name to
WP_Image_Editor
, and then pass the value to theimage_editor_output_format
filter, so that filter callbacks can make a contextual decision based on the image size. This will then be used to specify the output format forimage/jpeg
to be conditionallyimage/webp
, depending on whether this is configured for the given image size.Trac ticket: https://core.trac.wordpress.org/ticket/56526
### Relevant decisions
WP_Image_Editor
has been implemented in a fully backward compatible way which also works with any custom sub class implementations.$size
property.wp_default_image_output_mapping()
filter callback to now set theimage/jpeg
toimage/webp
mapping only if the given size supports it.