Title: Bug on crop_from_position function?
Last modified: August 20, 2016

---

# Bug on crop_from_position function?

 *  [lexplatt](https://wordpress.org/support/users/lexplatt/)
 * (@lexplatt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/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 );
       ```
   
 * [http://wordpress.org/extend/plugins/wp-thumb/](http://wordpress.org/extend/plugins/wp-thumb/)

The topic ‘Bug on crop_from_position function?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-thumb.svg)
 * [WPThumb](https://wordpress.org/plugins/wp-thumb/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-thumb/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-thumb/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-thumb/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-thumb/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [lexplatt](https://wordpress.org/support/users/lexplatt/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/bug-on-crop_from_position-function/)
 * Status: not resolved