Make WordPress Core


Ignore:
Timestamp:
10/31/2015 08:49:26 PM (11 years ago)
Author:
wonderboymusic
Message:

Media: add a new image size, medium_large. Bumps db version to add new options.

Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r35465 r35479  
    1515 * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
    1616 * 128 width and 96 height in pixels. Also supported for the string value is
    17  * 'medium' and 'full'. The 'full' isn't actually supported, but any value other
     17 * 'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other
    1818 * than the supported will result in the content_width size or 500 if that is
    1919 * not set.
     
    6161                $max_width = intval(get_option('medium_size_w'));
    6262                $max_height = intval(get_option('medium_size_h'));
    63                 // if no width is set, default to the theme content width if available
     63
     64        }
     65        elseif ( $size == 'medium_large' ) {
     66                $max_width = intval( get_option( 'medium_large_size_w' ) );
     67                $max_height = intval( get_option( 'medium_large_size_h' ) );
     68
     69                if ( intval( $content_width ) > 0 ) {
     70                        $max_width = min( intval( $content_width ), $max_width );
     71                }
    6472        }
    6573        elseif ( $size == 'large' ) {
     
    7280                $max_width = intval(get_option('large_size_w'));
    7381                $max_height = intval(get_option('large_size_h'));
    74                 if ( intval($content_width) > 0 )
     82                if ( intval($content_width) > 0 ) {
    7583                        $max_width = min( intval($content_width), $max_width );
     84                }
    7685        } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
    7786                $max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
     
    707716function get_intermediate_image_sizes() {
    708717        global $_wp_additional_image_sizes;
    709         $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
     718        $image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
    710719        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
    711720                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
     
    717726         *
    718727         * @param array $image_sizes An array of intermediate image sizes. Defaults
    719          *                           are 'thumbnail', 'medium', 'large'.
     728         *                           are 'thumbnail', 'medium', 'medium_large', 'large'.
    720729         */
    721730        return apply_filters( 'intermediate_image_sizes', $image_sizes );
Note: See TracChangeset for help on using the changeset viewer.