I'm using the AGImagepickerContoller
which could save multiple images from the camera roll, I am saving this way in the successBlock
:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask ,YES ); NSString *documentsDir = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"oneSlotImages%u.png", i]]; ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation]; UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]]; //----resize the images image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)]; NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:YES];
My problem is when saving, and is used loaded in my preview. it looks like this:
What I wanted is to have it like this in the preview:
I have read this iOS UIImagePickerController result image orientation after upload.
But I dont quite understand where I should put it in my code. Hope someone could guide in my problem. Thankyou.