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:
parent
6f2fe4da8f
commit
5eba5381e6
@ -227,6 +227,18 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $new_sizes ) ) {
|
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 );
|
$editor = wp_get_image_editor( $file );
|
||||||
|
|
||||||
if ( ! is_wp_error( $editor ) ) {
|
if ( ! is_wp_error( $editor ) ) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user