Skip to content

Commit 42f736b

Browse files
committed
Ensure there are no undefined array key full warnings when an image doesn't have a width and height
1 parent 433e690 commit 42f736b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

php/class-media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,8 @@ public function get_crop( $url, $attachment_id ) {
865865
$cropped = ! wp_image_matches_ratio(
866866
// PDFs do not always have width and height, but they do have full sizes.
867867
// This is important for the thumbnail crops on the media library.
868-
! empty( $meta['width'] ) ? $meta['width'] : $meta['sizes']['full']['width'],
869-
! empty( $meta['height'] ) ? $meta['height'] : $meta['sizes']['full']['height'],
868+
! empty( $meta['width'] ) ? $meta['width'] : ( ! empty( $meta['sizes']['full']['width'] ) ? $meta['sizes']['full']['width'] : 0 ),
869+
! empty( $meta['height'] ) ? $meta['height'] : ( ! empty( $meta['sizes']['full']['height'] ) ? $meta['sizes']['full']['height'] : 0 ),
870870
$size['width'],
871871
$size['height']
872872
);

0 commit comments

Comments
 (0)