mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Media: Output WebP by default when uploading JPEGs.
Uploaded JPEGs will automatically be converted to WebP sub-sizes instead of JPEG, saving space and making sites faster. The original JPEG upload is always retained and can be accessed by calling `wp_get_original_image_url`. Props azaozz, flixos90. Fixes #55443. git-svn-id: https://develop.svn.wordpress.org/trunk@54086 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3843,3 +3843,18 @@ function wp_media_attach_action( $parent_id, $action = 'attach' ) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the default image output mapping.
|
||||
*
|
||||
* With this filter callback, WebP image files will be generated for certain JPEG source files.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param array $output_mapping Map of mime type to output format.
|
||||
* @retun array The adjusted default output mapping.
|
||||
*/
|
||||
function wp_default_image_output_mapping( $output_mapping ) {
|
||||
$output_mapping['image/jpeg'] = 'image/webp';
|
||||
return $output_mapping;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user