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. Built from https://develop.svn.wordpress.org/trunk@54086 git-svn-id: http://core.svn.wordpress.org/trunk@53645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -917,10 +917,12 @@ function wp_save_image( $post_id ) {
|
||||
}
|
||||
|
||||
// Save the full-size file, also needed to create sub-sizes.
|
||||
if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) {
|
||||
$saved = wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id );
|
||||
if ( ! $saved ) {
|
||||
$return->error = esc_js( __( 'Unable to save the image.' ) );
|
||||
return $return;
|
||||
}
|
||||
$new_path = $saved['path'];
|
||||
|
||||
if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) {
|
||||
$tag = false;
|
||||
|
||||
Reference in New Issue
Block a user