Avoid trying to resize small images

This commit is contained in:
Mike Jolley 2019-02-21 16:58:40 +00:00
parent 287d65ab65
commit 54c1ef8615
1 changed files with 4 additions and 1 deletions

View File

@ -232,8 +232,11 @@ class WC_Regenerate_Images {
}
if ( ! $ratio_match ) {
// Check if the actual image has a larger dimension than the requested image size. Smaller images are not enlarged.
if ( $image[1] > $image_size['width'] || $image[2] > $image_size['height'] ) {
return self::resize_and_return_image( $attachment_id, $image, $size, $icon );
}
}
return $image;
}