0
我在服務器上發送了UIImage,但是當我接受它時,圖像旋轉了90°。 我maked這個用下面的代碼:當我在服務器上接收到圖像時,圖像旋轉了
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];
正如你所看到的,我試着旋轉的UIImageView,但沒有任何改變,當我在服務器上顯示的UIImage的。
在此先感謝。
編輯:圖像採取的方法takePicture。
這不適合我的工作,我不知道爲什麼 – Volgin
你在UI線程中嗎?我認爲這個問題是一個EXIF標誌,但因爲你使用的是PNG格式,它不是這樣的...你試試這個: - (id)initWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation? – martiall