Update class-wc-regenerate-images.php

Sometimes imagedata has not $imagedata['sizes']['full'] params. In my case, due to the fact that I am loading the SVG picture.
Therefore, an error is visible *Undefined index: height in class-wc-regenerate-images.php on line 222*
Therefore, a check for the emptiness of these parameters is added.
This commit is contained in:
yaroslawww 2019-02-27 13:53:32 +02:00 committed by GitHub
parent f90daea1d5
commit bb8bf5f749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -219,7 +219,9 @@ class WC_Regenerate_Images {
$imagedata['width'] = $imagedata['sizes']['full']['width'];
}
$ratio_match = wp_image_matches_ratio( $image[1], $image[2], $imagedata['width'], $imagedata['height'] );
if ( $image_size['width'] && $image_size['height'] ) {
$ratio_match = wp_image_matches_ratio($image[1], $image[2], $imagedata['width'], $imagedata['height']);
}
} else {
$ratio_match = wp_image_matches_ratio( $image[1], $image[2], $image_size['width'], $image_size['height'] );
}