NSArray *resources = [PHAssetResource assetResourcesForAsset:cell.model.asset];
NSURL * pathURL = [(PHAssetResource *)resources.firstObject valueForKey:@"privateFileURL"];
NSData * data = [NSData dataWithContentsOfURL:pathURL];
if([pathURL.absoluteString hasSuffix:@".GIF"]){
//将GIF图片转换成对应的图片源
CGImageSourceRef gifSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
//获取其中图片源个数,即由多少帧图片组成
size_t frameCout = CGImageSourceGetCount(gifSource);
CFRelease(gifSource);
if(frameCout > 150){
[tzImagePickerVc showAlertWithTitle:@"该GIF图尺寸过大,无法发送"];
return;
}
}
网友评论