The Image Editor should apply changes to custom image sizes by checking `$_wp_additional_image_sizes` for `$size` in `wp_save_image()` before arbitrarily going to the options table.
Props Otto42, SergeyBiryukov. Fixes #19889. Built from https://develop.svn.wordpress.org/trunk@27522 git-svn-id: http://core.svn.wordpress.org/trunk@27365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cd2e279d65
commit
00e63d2d2c
|
@ -636,6 +636,8 @@ function wp_restore_image($post_id) {
|
||||||
* @return \stdClass
|
* @return \stdClass
|
||||||
*/
|
*/
|
||||||
function wp_save_image( $post_id ) {
|
function wp_save_image( $post_id ) {
|
||||||
|
global $_wp_additional_image_sizes;
|
||||||
|
|
||||||
$return = new stdClass;
|
$return = new stdClass;
|
||||||
$success = $delete = $scaled = $nocrop = false;
|
$success = $delete = $scaled = $nocrop = false;
|
||||||
$post = get_post( $post_id );
|
$post = get_post( $post_id );
|
||||||
|
@ -770,8 +772,17 @@ function wp_save_image( $post_id ) {
|
||||||
$backup_sizes[$tag] = $meta['sizes'][$size];
|
$backup_sizes[$tag] = $meta['sizes'][$size];
|
||||||
}
|
}
|
||||||
|
|
||||||
$crop = $nocrop ? false : get_option("{$size}_crop");
|
if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
|
||||||
$_sizes[ $size ] = array( 'width' => get_option("{$size}_size_w"), 'height' => get_option("{$size}_size_h"), 'crop' => $crop );
|
$width = intval( $_wp_additional_image_sizes[ $size ]['width'] );
|
||||||
|
$height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
|
||||||
|
$crop = ( $nocrop ) ? false : intval( $_wp_additional_image_sizes[ $size ]['crop'] );
|
||||||
|
} else {
|
||||||
|
$height = get_option( "{$size}_size_h" );
|
||||||
|
$width = get_option( "{$size}_size_w" );
|
||||||
|
$crop = ( $nocrop ) ? false : get_option( "{$size}_crop" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
|
||||||
}
|
}
|
||||||
|
|
||||||
$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
|
$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
|
||||||
|
|
Loading…
Reference in New Issue