WordPress.org

Make WordPress Core

Ticket #35237: 35237.2.diff

File 35237.2.diff, 572 bytes (added by swissspidy, 5 years ago)

New patch using if ( ! empty( $meta['sizes'] ) )

  • src/wp-includes/embed-template.php

    diff --git src/wp-includes/embed-template.php src/wp-includes/embed-template.php
    index df2518f..fab8c84 100644
    if ( have_posts() ) : 
    5050                        $image_size   = 'full'; // Fallback.
    5151
    5252                        $meta = wp_get_attachment_metadata( $thumbnail_id );
    53                         if ( is_array( $meta ) ) {
     53                        if ( ! empty( $meta['sizes'] ) ) {
    5454                                foreach ( $meta['sizes'] as $size => $data ) {
    5555                                        if ( $data['width'] / $data['height'] > $aspect_ratio ) {
    5656                                                $aspect_ratio = $data['width'] / $data['height'];