Title: Crop Issue
Last modified: August 17, 2021

---

# Crop Issue

 *  Resolved [brening](https://wordpress.org/support/users/brening/)
 * (@brening)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/crop-issue-2/)
 * Hallo!
    I am using the crop method for an object of the WP_Image_Editor class.
   I have several images for which this method does not work correctly. For example:
   [https://postlmg.cc/WdXRVBXk](https://postlmg.cc/WdXRVBXk) My code:
 *     ```
       $image_path = 'https://postlmg.cc/WdXRVBXk';
       $image_path1 = '/localhost/blue1.jpeg';
   
       $image = wp_get_image_editor($image_path);
       $image->crop(0, 2532, 918, 918);
       $image->save($image_path1);
       ```
   
 * The new image is stretched and the area does not correspond to the data specified
   in the parameters.
    Help me solve the problem.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [brening](https://wordpress.org/support/users/brening/)
 * (@brening)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/crop-issue-2/#post-14777215)
 * I found out that for images with a size of 3024*4032, the wp_get_image_editor
   function confuses the height and width. Therefore, the crop method then incorrectly
   selects the area. But I didn’t find a regularity when exactly the function wp_get_image_editor
   confuses height and width. That’s why I still need help.
 *  Thread Starter [brening](https://wordpress.org/support/users/brening/)
 * (@brening)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/crop-issue-2/#post-14783929)
 * Everything was solved with one line of code:
    $image->maybe_exif_rotate();
 * This function check if a JPEG image has EXIF Orientation tag and rotate it if
   needed.
    Maybe it will help someone.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Crop Issue’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [brening](https://wordpress.org/support/users/brening/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/crop-issue-2/#post-14783929)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
