Make WordPress Core

Ticket #34225: 34225.diff

File 34225.diff, 1.7 KB (added by krogsgard, 8 years ago)

add info context, clean up curly brackets, and check context for large images

  • wp-includes/media.php

     
    7070                 */
    7171                $max_width = intval(get_option('large_size_w'));
    7272                $max_height = intval(get_option('large_size_h'));
    73                 if ( intval($content_width) > 0 )
     73                if ( intval($content_width) > 0 && 'edit' == $context ) {
    7474                        $max_width = min( intval($content_width), $max_width );
     75                }
    7576        } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
    7677                $max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
    7778                $max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
    78                 if ( intval($content_width) > 0 && 'edit' == $context ) // Only in admin. Assume that theme authors know what they're doing.
     79                // Only in admin. Assume that theme authors know what they're doing.
     80                if ( intval($content_width) > 0 && 'edit' == $context ) {
    7981                        $max_width = min( intval($content_width), $max_width );
     82                }
    8083        }
    8184        // $size == 'full' has no constraint
    8285        else {
     
    29312934
    29322935                                // We have the actual image size, but might need to further constrain it if content_width is narrower.
    29332936                                // Thumbnail, medium, and full sizes are also checked against the site's height/width options.
    2934                                 list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
     2937                                list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'info' );
    29352938
    29362939                                $sizes[ $size ] = array(
    29372940                                        'height'      => $height,