Merge pull request #22461 from woocommerce/fix/21761
Bail if getimagesize fails in filter_image_sizes_to_only_missing_thumbnails
This commit is contained in:
commit
ca3623fa41
|
@ -101,8 +101,12 @@ class WC_Regenerate_Images_Request extends WC_Background_Process {
|
|||
|
||||
$log = wc_get_logger();
|
||||
|
||||
// translators: %s: ID of the attachment.
|
||||
$log->info( sprintf( __( 'Regenerating images for attachment ID: %s', 'woocommerce' ), $this->attachment_id ),
|
||||
$log->info(
|
||||
sprintf(
|
||||
// translators: %s: ID of the attachment.
|
||||
__( 'Regenerating images for attachment ID: %s', 'woocommerce' ),
|
||||
$this->attachment_id
|
||||
),
|
||||
array(
|
||||
'source' => 'wc-image-regeneration',
|
||||
)
|
||||
|
@ -202,7 +206,11 @@ class WC_Regenerate_Images_Request extends WC_Background_Process {
|
|||
$size_data['crop'] = false;
|
||||
}
|
||||
|
||||
list( $orig_w, $orig_h ) = getimagesize( $fullsizepath );
|
||||
$image_sizes = getimagesize( $fullsizepath );
|
||||
if ( false === $image_sizes ) {
|
||||
continue;
|
||||
}
|
||||
list( $orig_w, $orig_h ) = $image_sizes;
|
||||
|
||||
$dimensions = image_resize_dimensions( $orig_w, $orig_h, $size_data['width'], $size_data['height'], $size_data['crop'] );
|
||||
|
||||
|
@ -222,6 +230,7 @@ class WC_Regenerate_Images_Request extends WC_Background_Process {
|
|||
unset( $sizes[ $size ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $sizes;
|
||||
}
|
||||
|
||||
|
@ -243,7 +252,8 @@ class WC_Regenerate_Images_Request extends WC_Background_Process {
|
|||
protected function complete() {
|
||||
parent::complete();
|
||||
$log = wc_get_logger();
|
||||
$log->info( __( 'Completed product image regeneration job.', 'woocommerce' ),
|
||||
$log->info(
|
||||
__( 'Completed product image regeneration job.', 'woocommerce' ),
|
||||
array(
|
||||
'source' => 'wc-image-regeneration',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue