Make WordPress Core

Ticket #47713: 47713.diff

File 47713.diff, 1.2 KB (added by mahnunchik, 5 years ago)

Select full size image if it is exact match to intermediate image fixes #47713 and #21714

  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 1cf3d3ff0b..c9b8c74ca6 100644
    a b function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { 
    759759                        */
    760760                } elseif ( ! empty( $imagedata['sizes']['thumbnail'] ) && $imagedata['sizes']['thumbnail']['width'] >= $size[0] && $imagedata['sizes']['thumbnail']['width'] >= $size[1] ) {
    761761                        $data = $imagedata['sizes']['thumbnail'];
     762                } elseif ( $size[0] == $imagedata['width'] && $size[1] == $imagedata['height'] ) {
     763                        $data = $imagedata;
    762764                } else {
    763765                        return false;
    764766                }
    function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { 
    768770
    769771        } elseif ( ! empty( $imagedata['sizes'][ $size ] ) ) {
    770772                $data = $imagedata['sizes'][ $size ];
     773        } elseif ( ! empty( $_wp_additional_image_sizes = wp_get_additional_image_sizes() ) && ! empty( $_wp_additional_image_sizes[ $size ] ) && $_wp_additional_image_sizes[ $size ]['width'] == $imagedata['width'] && $_wp_additional_image_sizes[ $size ]['height'] == $imagedata['height'] ) {
     774                $data = $imagedata;
    771775        }
    772776
    773777        // If we still don't have a match at this point, return false.