Make WordPress Core

Ticket #47713: 47713.2.diff

File 47713.2.diff, 1.4 KB (added by mahnunchik, 4 years ago)

correct patch

  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 1cf3d3ff0b..6731a6562a 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 = array(
     764                                'width'  => $imagedata['width'],
     765                                'height' => $imagedata['height'],
     766                                'file'   => wp_basename( $imagedata['file'] ),
     767                        );
    762768                } else {
    763769                        return false;
    764770                }
    function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { 
    768774
    769775        } elseif ( ! empty( $imagedata['sizes'][ $size ] ) ) {
    770776                $data = $imagedata['sizes'][ $size ];
     777        } 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'] ) {
     778                $data = array(
     779                        'width'  => $imagedata['width'],
     780                        'height' => $imagedata['height'],
     781                        'file'   => wp_basename( $imagedata['file'] ),
     782                );
    771783        }
    772784
    773785        // If we still don't have a match at this point, return false.