Media: Sort the new sizes array by priority when creating image sub-sizes.

See #40439.
Built from https://develop.svn.wordpress.org/trunk@45645


git-svn-id: http://core.svn.wordpress.org/trunk@45456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-07-16 21:48:56 +00:00
parent 6f2fe4da8f
commit 5eba5381e6
2 changed files with 13 additions and 1 deletions

View File

@ -227,6 +227,18 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
}
if ( ! empty( $new_sizes ) ) {
// Sort the image sub-sizes in order of priority when creating them.
// This ensures there is an appropriate sub-size the user can access immediately
// even when there was an error and not all sub-sizes were created.
$priority = array(
'medium' => null,
'large' => null,
'thumbnail' => null,
'medium_large' => null,
);
$new_sizes = array_filter( array_merge( $priority, $new_sizes ) );
$editor = wp_get_image_editor( $file );
if ( ! is_wp_error( $editor ) ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45644';
$wp_version = '5.3-alpha-45645';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.