WordPress.org

Make WordPress Core

Ticket #18947: 18947.patch

File 18947.patch, 2.2 KB (added by F J Kaiser, 7 years ago)
  • wp-admin/includes/image.php

     
    103103                // make thumbnails and other intermediate sizes
    104104                global $_wp_additional_image_sizes;
    105105
    106                 foreach ( get_intermediate_image_sizes() as $s ) {
     106                foreach ( array_keys( get_intermediate_image_sizes() ) as $s ) {
    107107                        $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
    108108                        if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
    109109                                $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
  • wp-includes/media.php

     
    583583 */
    584584function get_intermediate_image_sizes() {
    585585        global $_wp_additional_image_sizes;
    586         $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
     586        $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
     587        foreach ( $image_sizes as $size ) {
     588                $image_sizes[ $size ]['width']  = intval( get_option( "{$size}_size_w") );
     589                $image_sizes[ $size ]['height'] = intval( get_option( "{$size}_size_h") );
     590                // Crop false per default if not set
     591                $image_sizes[ $size ]['crop']   = get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false;
     592        }
    587593        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
    588594                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
    589595
  • wp-includes/post.php

     
    38173817        }
    38183818
    38193819        // remove intermediate and backup images if there are any
    3820         foreach ( get_intermediate_image_sizes() as $size ) {
     3820        foreach ( array_keys( get_intermediate_image_sizes() ) as $size ) {
    38213821                if ( $intermediate = image_get_intermediate_size($post_id, $size) ) {
    38223822                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
    38233823                        @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );