Bug on crop_from_position function?
-
Is it possible that there is a mismatch of the array index in the crop_from_position function in wpthumb.php:
if ( $position[0] == 'bottom' ) $crop['y'] = absint( $size['height'] - $height ); else if ( $position[1] == 'center' ) $crop['y'] = intval( absint( $size['height'] - $height ) / 2 ); if ( $position[1] == 'right' )1 $crop['x'] = absint( $size['width'] - $width ); else if ( $position[0] == 'center' ) $crop['x'] = intval( absint( $size['width'] - $width ) / 2 );
Changing in these lines the array indices as seen below lead me to a correct visualisation of the images
if ( $position[1] == 'bottom' ) // changed index 0 to 1 $crop['y'] = absint( $size['height'] - $height ); else if ( $position[1] == 'center' ) $crop['y'] = intval( absint( $size['height'] - $height ) / 2 ); if ( $position[0] == 'right' ) // hanged index 1 to 0 $crop['x'] = absint( $size['width'] - $width ); else if ( $position[0] == 'center' ) $crop['x'] = intval( absint( $size['width'] - $width ) / 2 );
- The topic ‘Bug on crop_from_position function?’ is closed to new replies.