WordPress.org

Make WordPress Core

Ticket #35390: 35390.3.patch

File 35390.3.patch, 1.0 KB (added by joemcgill, 4 years ago)
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 7b99f95..5e73344 100644
    function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co 
    4242        global $content_width, $_wp_additional_image_sizes;
    4343
    4444        if ( ! $context )
    45                 $context = is_admin() ? 'edit' : 'display';
     45                $context = ( is_admin() && ! defined( 'DOING_AJAX' ) ) ? 'edit' : 'display';
    4646
    4747        if ( is_array($size) ) {
    4848                $max_width = $size[0];
    function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co 
    7979                 */
    8080                $max_width = intval(get_option('large_size_w'));
    8181                $max_height = intval(get_option('large_size_h'));
    82                 if ( intval($content_width) > 0 ) {
     82                if ( intval($content_width) > 0  && 'edit' === $context ) {
    8383                        $max_width = min( intval($content_width), $max_width );
    8484                }
    8585        } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {