WordPress.org

Make WordPress Core

Ticket #10263: get_intermediate_sizes.2.patch

File get_intermediate_sizes.2.patch, 2.4 KB (added by scribu, 8 years ago)

compatible with r12593

  • wp-includes/post.php

     
    28992899        }
    29002900
    29012901        // remove intermediate and backup images if there are any
    2902         $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));
    2903         foreach ( $sizes as $size ) {
     2902        foreach ( get_intermediate_image_sizes() as $size ) {
    29042903                if ( $intermediate = image_get_intermediate_size($post_id, $size) ) {
    29052904                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
    29062905                        @ unlink( path_join($uploadpath['basedir'], $intermediate_file) );
  • wp-includes/media.php

     
    507507}
    508508
    509509/**
     510 * Get the available image sizes
     511 * @since 3.0
     512 * @return array Returns a filtered array of image size strings
     513 */
     514function get_intermediate_image_sizes() {
     515        global $_wp_additional_image_sizes;
     516        $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
     517        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
     518                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
     519
     520        return apply_filters( 'intermediate_image_sizes', $image_sizes );
     521}
     522
     523/**
    510524 * Retrieve an image to represent an attachment.
    511525 *
    512526 * A mime icon for files, thumbnail or intermediate size for images.
  • wp-admin/includes/image.php

     
    102102
    103103                // make thumbnails and other intermediate sizes
    104104                global $_wp_additional_image_sizes;
    105                 $temp_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
    106                 if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
    107                         $temp_sizes = array_merge( $temp_sizes, array_keys( $_wp_additional_image_sizes ) );
    108105
    109                 $temp_sizes = apply_filters( 'intermediate_image_sizes', $temp_sizes );
    110 
    111                 foreach ( $temp_sizes as $s ) {
     106                foreach ( get_intermediate_image_sizes() as $s ) {
    112107                        $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
    113108                        if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
    114109                                $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes