Fixed images crop option and wc_get_image_size() function

Reported in http://wordpress.org/support/topic/hard-crop

@mikejolley
This commit is contained in:
claudiosmweb 2014-09-11 21:22:30 -03:00
parent cfb8d42bcb
commit ec9e08ba7d
3 changed files with 5 additions and 5 deletions

View File

@ -480,7 +480,7 @@ class WC_Admin_Settings {
$size = wc_get_image_size( $image_size );
$width = isset( $size[ 'width' ] ) ? $size[ 'width' ] : $value[ 'default' ][ 'width' ];
$height = isset( $size[ 'height' ] ) ? $size[ 'height' ] : $value[ 'default' ][ 'height' ];
$crop = isset( $size[ 'height' ] ) ? $size[ 'crop' ] : $value[ 'default' ][ 'crop' ];
$crop = isset( $size[ 'crop' ] ) ? $size[ 'crop' ] : $value[ 'default' ][ 'crop' ];
$disabled_attr = '';
$disabled_message = '';
@ -496,7 +496,7 @@ class WC_Admin_Settings {
<input name="<?php echo esc_attr( $value['id'] ); ?>[width]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> &times; <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
<label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Hard Crop?', 'woocommerce' ); ?></label>
<label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" <?php echo $disabled_attr; ?> id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" value="1" <?php checked( 1, $crop ); ?> /> <?php _e( 'Hard Crop?', 'woocommerce' ); ?></label>
</td>
</tr><?php

View File

@ -374,7 +374,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'default' => array(
'width' => '150',
'height' => '150',
'crop' => true
'crop' => 1
),
'desc_tip' => true,
),

View File

@ -402,7 +402,7 @@ function wc_get_image_size( $image_size ) {
$size = get_option( $image_size . '_image_size', array() );
$size['width'] = isset( $size['width'] ) ? $size['width'] : '300';
$size['height'] = isset( $size['height'] ) ? $size['height'] : '300';
$size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 1;
$size['crop'] = isset( $size['crop'] ) ? 1 : 0;
} else {
$size = array(
'width' => '300',