Media: Prevent uploading and show an error message when the server doesn't support editing of WebP files and image sub-sizes cannot be created.

Props adamsilverstein, desrosj, azaozz
Fixes #53475
Built from https://develop.svn.wordpress.org/trunk@51211


git-svn-id: http://core.svn.wordpress.org/trunk@50820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2021-06-22 23:12:57 +00:00
parent 48e31b23f5
commit e93093f7ed
3 changed files with 9 additions and 2 deletions

View File

@ -3300,6 +3300,13 @@ function get_allowed_mime_types( $user = null ) {
unset( $t['htm|html'], $t['js'] );
}
// Add WebP if the server supports it.
unset( $t['webp'] );
if ( wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$t['webp'] = 'image/webp';
}
/**
* Filters list of allowed mime types and file extensions.
*

View File

@ -851,7 +851,7 @@ function wp_default_scripts( $scripts ) {
/* translators: %s: File name. */
'file_exceeds_size_limit' => __( '%s exceeds the maximum upload size for this site.' ),
'zero_byte_file' => __( 'This file is empty. Please try another.' ),
'invalid_filetype' => __( 'Sorry, this file type is not permitted for security reasons.' ),
'invalid_filetype' => __( 'Sorry, this file type is not supported.' ),
'not_an_image' => __( 'This file is not an image. Please try another.' ),
'image_memory_exceeded' => __( 'Memory exceeded. Please try another smaller file.' ),
'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-beta2-51210';
$wp_version = '5.8-beta2-51211';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.