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:
Mike Jolley 2019-01-16 16:37:09 +00:00 committed by GitHub
commit ca3623fa41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 4 deletions

View File

@ -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',
)