Typecast sizes to int and avoid 9999999999

This commit is contained in:
Mike Jolley 2018-02-01 16:58:57 +00:00
parent 40098feb3c
commit 997e8aefde
1 changed files with 7 additions and 7 deletions

View File

@ -724,22 +724,22 @@ function wc_get_image_size( $image_size ) {
if ( is_array( $image_size ) ) {
$size = array(
'width' => isset( $image_size[0] ) ? $image_size[0] : 600,
'height' => isset( $image_size[1] ) ? $image_size[1] : 600,
'crop' => isset( $image_size[2] ) ? $image_size[2] : 1,
'width' => isset( $image_size[0] ) ? absint( $image_size[0] ) : 600,
'height' => isset( $image_size[1] ) ? absint( $image_size[1] ) : 600,
'crop' => isset( $image_size[2] ) ? absint( $image_size[2] ) : 1,
);
$image_size = $size['width'] . '_' . $size['height'];
} elseif ( in_array( $image_size, array( 'single', 'shop_single', 'woocommerce_single' ), true ) ) {
$size['width'] = wc_get_theme_support( 'single_image_width', get_option( 'woocommerce_single_image_width', 600 ) );
$size['height'] = 9999999999;
$size['width'] = absint( wc_get_theme_support( 'single_image_width', get_option( 'woocommerce_single_image_width', 600 ) ) );
$size['height'] = '';
$size['crop'] = 0;
$image_size = 'single';
} elseif ( in_array( $image_size, array( 'thumbnail', 'shop_thumbnail', 'shop_catalog', 'woocommerce_thumbnail' ), true ) ) {
$size['width'] = wc_get_theme_support( 'thumbnail_image_width', get_option( 'woocommerce_thumbnail_image_width', 300 ) );
$size['width'] = absint( wc_get_theme_support( 'thumbnail_image_width', get_option( 'woocommerce_thumbnail_image_width', 300 ) ) );
$cropping = get_option( 'woocommerce_thumbnail_cropping', '1:1' );
if ( 'uncropped' === $cropping ) {
$size['height'] = 9999999999;
$size['height'] = '';
$size['crop'] = 0;
} elseif ( 'custom' === $cropping ) {
$width = max( 1, get_option( 'woocommerce_thumbnail_cropping_custom_width', '4' ) );