Skip to content

Commit f44aa0f

Browse files
Merge pull request #1046 from cloudinary/fix/get-crop-full
Optimize wp_image_matches_ratio in get_crop
2 parents 94e1d55 + 42f736b commit f44aa0f

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
@@ -874,8 +874,8 @@ public function get_crop( $url, $attachment_id ) {
874874
$cropped = ! wp_image_matches_ratio(
875875
// PDFs do not always have width and height, but they do have full sizes.
876876
// This is important for the thumbnail crops on the media library.
877-
! empty( $meta['width'] ) ? $meta['width'] : $meta['sizes']['full']['width'],
878-
! empty( $meta['height'] ) ? $meta['height'] : $meta['sizes']['full']['height'],
877+
! empty( $meta['width'] ) ? $meta['width'] : ( ! empty( $meta['sizes']['full']['width'] ) ? $meta['sizes']['full']['width'] : 0 ),
878+
! empty( $meta['height'] ) ? $meta['height'] : ( ! empty( $meta['sizes']['full']['height'] ) ? $meta['sizes']['full']['height'] : 0 ),
879879
$size['width'],
880880
$size['height']
881881
);

0 commit comments

Comments
 (0)