Это решено.
Главный ключ для сокращения. Я уменьшил размер изображения до 116 кб.
NSData *imgData=UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],compressionRatio);
while ([imgData length]>50000) {
compressionRatio=compressionRatio*0.5;
imgData=UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],compressionRatio);
}
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
double compressionRatio=1;
NSData *imgData=UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],compressionRatio);
while ([imgData length]>50000) {
compressionRatio=compressionRatio*0.5;
imgData=UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],compressionRatio);
}
UIImage *img=[[UIImage alloc] initWithData:imgData];
facImgView.image=img;
NSLog(@"%@",[info objectForKey:@"UIImagePickerControllerOriginalImage"],3);
[img release];
NSString *str=[NSString stringWithFormat:@"%i.jpg",[currentFaculty facultyNo]];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [NSString stringWithFormat:@"%@", [paths objectAtIndex:0]];
path=[path stringByDeletingLastPathComponent];
path=[NSString stringWithFormat:@"%@/%@",path,str];
[imgData writeToFile:path atomically:YES];
[picker dismissModalViewControllerAnimated:YES];
}