I've been using the Image Rotation Repair plugin to fix the orientation of images when uploading using the Media Uploader (some images taken on my camera phone are not rotated on upload, resulting in them displaying upside-down etc).

Although it worked pre WP 4.0 (possibly pre WP 3.9), uploading now fails and I get the error message: "An error occurred in the upload, please try again later".

Deactivation of the plugin resolves the upload error problem, but now the orientation of my images isn't right after uploading. Some need to be rotated.

I've also tried the Image Rotation Fixer plugin which results in the exact same upload error problem.

How can I fix the orientation of my images when uploading via the WordPress Media Uploader?

closed as off-topic by TheDeadMedic, kaiser May 12 '16 at 17:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

You can do this without a plugin in the newest versions of Wordpress. Go to Media, click on any image and then click on the edit image button. You can edit the image there and one of the options is rotation.

  • Thanks, but I need to do this automatically – henrywright Oct 30 '14 at 15:28

My solution was to replace the following in image-rotation-repair.php

$image = _rotate_image_resource( $image, $orientation );

with

$rotated = imagerotate( $image, $orientation, 0 );
if ( is_resource( $rotated ) ) {
    imagedestroy( $image );
    $image = $rotated;
}

Note: Usually, modifying a plugin's code is a bad solution, but in this particular case _rotate_image_resource() is deprecated so the plugin author may eventually replace the function anyway. I've made a note on the plugin's support forum.

Not the answer you're looking for? Browse other questions tagged or ask your own question.