Make WordPress Core

Changeset 27522


Ignore:
Timestamp:
03/13/2014 04:17:36 AM (11 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image-edit.php

    r27357 r27522  
    637637 */
    638638function wp_save_image( $post_id ) {
     639    global $_wp_additional_image_sizes;
     640
    639641    $return = new stdClass;
    640642    $success = $delete = $scaled = $nocrop = false;
     
    771773            }
    772774
    773             $crop = $nocrop ? false : get_option("{$size}_crop");
    774             $_sizes[ $size ] = array( 'width' => get_option("{$size}_size_w"), 'height' => get_option("{$size}_size_h"), 'crop' => $crop );
     775            if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
     776                $width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
     777                $height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
     778                $crop   = ( $nocrop ) ? false : intval( $_wp_additional_image_sizes[ $size ]['crop'] );
     779            } else {
     780                $height = get_option( "{$size}_size_h" );
     781                $width  = get_option( "{$size}_size_w" );
     782                $crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
     783            }
     784
     785            $_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
    775786        }
    776787
Note: See TracChangeset for help on using the changeset viewer.