[wp-trac] [WordPress Trac] #55443: Create WebP sub-sizes and use for output
WordPress Trac
noreply at wordpress.org
Wed Sep 7 21:43:44 UTC 2022
#55443: Create WebP sub-sizes and use for output
-------------------------------------------------+-------------------------
Reporter: adamsilverstein | Owner:
| adamsilverstein
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.1
Component: Media | Version: 6.0
Severity: normal | Resolution: fixed
Keywords: has-unit-tests needs-dev-note | Focuses:
needs-docs needs-user-docs has-patch commit | performance
-------------------------------------------------+-------------------------
Comment (by flixos90):
In [changeset:"54097" 54097]:
{{{
#!CommitTicketReference repository="" revision="54097"
Media: Generate WebP only for certain registered image sizes.
The existing filter `image_editor_output_format` receives an additional
parameter `$size_name` which is populated whenever it controls the output
format for a specific registered image size to create. Otherwise, it
remains empty. In order to achieve this, a low level change has been added
in bringing a new `$size_name` class property to the `WP_Image_Editor`
base class, which is introduced in a backward compatible way that will not
cause conflicts with custom implementations.
This parameter is then used in new logic inside the
`wp_default_image_output_mapping()` callback function for the filter,
controlling whether `image/jpeg` should map to `image/webp` output or not.
By default, this is enabled for all WordPress core image sizes by default,
and this list can be modified using a new
`wp_image_sizes_with_additional_mime_type_support` filter, e.g. to remove
core sizes or add custom sizes.
The customization per image size may be further enhanced by providing a
more declarative API via a new parameter on the `add_image_size()`
function.
Props eugenemanuilov, flixos90, adamsilverstein, joegrainger.
Fixes #56526.
See #55443, #56288.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55443#comment:195>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list