0

I send an UIImage on my server, but when I reveive it, the image is rotated by 90°. I maked this with the following code :

UIImageView *iv = [[UIImageView alloc] initWithImage:screenshot];
iv.center = CGPointMake(100.0, 100.0);
iv.transform = CGAffineTransformMakeRotation(3.14159265/2);

NSData *imageData = UIImagePNGRepresentation(iv.image);

// on créé la requete
NSURL *url = [NSURL URLWithString:@"http://myserver/test.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setData:imageData withFileName:@"tmp.png" andContentType:@"image/png" forKey:@"userfile"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request startAsynchronous];

As you can see, I try to rotate the UIImageView but there is no change when I display the UIImage on the server.
Thanks in advance.

EDIT : The image is taken with the method takePicture.

Volgin
  • 27
  • 1
  • 4

1 Answers1

1

You are just rotating the display of UIImageView

To rotate the UIImage you have to use code like :

How to Rotate a UIImage 90 degrees?

Community
  • 1
  • 1
martiall
  • 981
  • 6
  • 7
  • Are you in the UI Thread ? I thought the problem was an EXIF flag but because you are using PNG format it's not that ... Have you try this : - (id)initWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation ? – martiall Jun 29 '11 at 16:08