WordPress.org

Make WordPress Core

Ticket #10263: get_intermediate_sizes.patch

File get_intermediate_sizes.patch, 1.8 KB (added by scribu, 9 years ago)

Single function that replaces hardcoded array

  • wp-includes/media.php

     
    486486}
    487487
    488488/**
     489 * Get the available image sizes
     490 * @since 2.8.1
     491 * @return array Returns a filtered array of image size strings
     492 */
     493function get_intermediate_sizes()
     494{
     495        return apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));
     496}
     497
     498/**
    489499 * Retrieve an image to represent an attachment.
    490500 *
    491501 * A mime icon for files, thumbnail or intermediate size for images.
  • wp-includes/post.php

     
    26132613        }
    26142614
    26152615        // remove intermediate images if there are any
    2616         $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));
     2616        $sizes = get_intermediate_sizes();
    26172617        foreach ( $sizes as $size ) {
    26182618                if ( $intermediate = image_get_intermediate_size($postid, $size) ) {
    26192619                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
  • wp-admin/includes/image.php

     
    105105                $metadata['file'] = $file;
    106106
    107107                // make thumbnails and other intermediate sizes
    108                 $sizes = array('thumbnail', 'medium', 'large');
    109                 $sizes = apply_filters('intermediate_image_sizes', $sizes);
     108                $sizes = get_intermediate_sizes();
    110109
    111110                foreach ($sizes as $size) {
    112111                        $resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );