How to rotate this photo from imagePickerController 90 degrees?

This instance of imagePickerController takes a photo and sets it to a UIImageView IBOutlet.

.h
@property (retain, strong) UIImage* Image;
.m
#pragma mark - Image picker delegate methods

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

	UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

    // Resize the image from the camera

	UIImage *scaledImage = [image resizedImageWithContentMode:UIViewContentModeScaleAspectFill bounds:CGSizeMake(photo.frame.size.width, photo.frame.size.height) interpolationQuality:kCGInterpolationHigh];

    // Crop the image to a square (yikes, fancy!)

    UIImage *croppedImage = [scaledImage croppedImage:CGRectMake((scaledImage.size.width -photo.frame.size.width)/2, (scaledImage.size.height -photo.frame.size.height)/2, photo.frame.size.width, photo.frame.size.height)];

    // Show the photo on the screen

    photo.image = croppedImage;

    [picker dismissModalViewControllerAnimated:NO];

}

After the photo is taken, it is over rotated 90 degrees? How can it be rotated back in place?

Solved

    photo.transform=CGAffineTransformMakeRotation(M_PI*0.5);

What is resizedImageWithContentMode:bounds:interpolationQuality:? As far as I know, UIImage does not have such a method. I guess it is not properly handling imageOrientation. You may need to update the implementation of the method or modify the orientation by yourself. You say sets it to a UIImage property, but your imagePickerController:didFinishPickingMediaWithInfo: sets the image into a UIImageView, not to a UIImage property, that prevents writing more detailed answer.

True, I caught that error as well. It wasn't a UIImage Property. It was an IBOutlet UIImageView. Solved.

Interesting. Now the photo is being rotated to its correct orientation after it is captured, and is being uploaded to the server correctly. But when the default image is uploaded to the server, it is over rotated.

Also when the full size photo is viewed, it is back to being over rotated.

How to rotate this photo from imagePickerController 90 degrees?
 
 
Q