Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fixed incorrect file extension on ios
  • Loading branch information
l0stpenguin authored Oct 15, 2019
commit 10ed770d1c656ca94ac7c306eeec3de04cbf5f40
5 changes: 4 additions & 1 deletion src/ios/GMImagePicker/GMGridViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,13 @@ - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtInde
fetch_item.be_progressed = false;
fetch_item.be_finished = true;

NSString *fileName =[asset valueForKey:@"filename"];
NSString * fileExtension = [fileName pathExtension];
if ([dataUTI containsString:@"heic"]) {
CIImage *ciImage = [CIImage imageWithData:imageData];
NSData* data = [[[CIContext alloc] init] JPEGRepresentationOfImage:ciImage colorSpace:CGColorSpaceCreateDeviceRGB() options:@{}];
imageData = data;
fileExtension = "jpg";
}


Expand All @@ -507,7 +510,7 @@ - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtInde
NSString * filePath;
do {

filePath = [NSString stringWithFormat:@"%@/%@.%@", libPath, [[NSUUID UUID] UUIDString], @"jpg"];
filePath = [NSString stringWithFormat:@"%@/%@.%@", libPath, [[NSUUID UUID] UUIDString], [fileExtension lowercaseString]];
} while ([fileMgr fileExistsAtPath:filePath]);

fetch_item.be_saving_img = true;
Expand Down