Allow fallback to generic image loading when PNG/JPEG-specific loads fail.
This commit is contained in:
parent
60bd422401
commit
1c6088872a
1 changed files with 4 additions and 2 deletions
|
|
@ -49,7 +49,7 @@ static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *r
|
|||
return nil;
|
||||
}
|
||||
|
||||
CGImageRef imageRef;
|
||||
CGImageRef imageRef = nil;
|
||||
|
||||
CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
|
||||
|
||||
|
|
@ -58,7 +58,9 @@ static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *r
|
|||
imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||
} else if ([contentTypes containsObject:@"image/jpeg"]) {
|
||||
imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!imageRef) {
|
||||
UIImage *image = AFImageWithDataAtScale(data, scale);
|
||||
if (image.images) {
|
||||
CGDataProviderRelease(dataProvider);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue