After I pick one image by UIImagePickerController, I get UIImage and rewrite the image data to a temporary file. In the end, I use the temporary file location to upload this image to server. However, if I pick a gif, I will end up getting an image. I wonder if there is any way I can get gif by UIImagePickerController.
UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *jpegData = UIImageJPEGRepresentation(originalImage, 1);
NSString *parentDirectoryPath = [NSString stringWithFormat:
@"Pixured/%@Sessions/Session_%@",
[CurrentAppUser getInstance].user.id,
[PixuredUtility getTimeStamp]];
if (![[NSFileManager defaultManager] fileExistsAtPath:[PixuredUtility appendDocumentsDirectory:parentDirectoryPath]]) {
[[NSFileManager defaultManager] createDirectoryAtPath:[PixuredUtility appendDocumentsDirectory:parentDirectoryPath]
withIntermediateDirectories:YES
attributes:nil
error:nil];
}
NSString *imageFilePath = [parentDirectoryPath stringByAppendingFormat:@"/RAW_IMG_%@.jpeg", [PixuredUtility generatePostID]];
NSString *fullImageFilePath = [PixuredUtility appendDocumentsDirectory:imageFilePath];
BOOL writeSuccess = [jpegData writeToFile:fullImageFilePath atomically:YES];
Thank you so much