Commit e9817811 authored by 林生雨's avatar 林生雨

m

parent 2968d778
This diff is collapsed.
...@@ -526,7 +526,19 @@ PHImageRequestOptions *baseImageRequestOption; ...@@ -526,7 +526,19 @@ PHImageRequestOptions *baseImageRequestOption;
PHAsset * assets=self.scanMap[path]; PHAsset * assets=self.scanMap[path];
@autoreleasepool{ @autoreleasepool{
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:baseImageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) { [[PHImageManager defaultManager] requestImageDataForAsset:assets options:baseImageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[FlutterStandardTypedData typedDataWithBytes:UIImageJPEGRepresentation([UIImage imageWithData:imageData], 1.0)]]; NSData *imageDataW = nil;
if ([dataUTI isEqualToString:@"public.heif"] || [dataUTI isEqualToString:@"public.heic"]) {
CIImage *ciImage = [CIImage imageWithData:imageData];
CIContext *context = [CIContext context];
NSData *jpgData = [context JPEGRepresentationOfImage:ciImage colorSpace:ciImage.colorSpace options:@{}];
imageDataW = jpgData;
} else {
imageDataW = imageData;
}
// if ([imageDataW length] / (1024 * 1024) > 3.0) {
// imageDataW = [[UIImage imageWithData: imageDataW] c]; //图片大于3M压缩操作,可不调用此方法
// }
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :[FlutterStandardTypedData typedDataWithBytes:UIImageJPEGRepresentation([UIImage imageWithData:imageDataW], 1.0)]];
}]; }];
} }
}else if ([[self.takePhotoMap allKeys] containsObject:path]){ }else if ([[self.takePhotoMap allKeys] containsObject:path]){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment