...
|
...
|
@@ -169,13 +169,25 @@ static SDImageCache *instance; |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (UIImage *) imageForFile:(NSString*)fileKey {
|
|
|
NSString *file = [self cachePathForKey:fileKey];
|
|
|
NSData *imageData = [NSData dataWithContentsOfFile:file];
|
|
|
if (imageData) {
|
|
|
UIImage *image = [[[UIImage alloc] initWithData:imageData ] autorelease];
|
|
|
CGFloat scale = 1.0;
|
|
|
if ([fileKey hasSuffix:@"@2x.png"] || [fileKey hasSuffix:@"@2x.jpg"]) {
|
|
|
scale = 2.0;
|
|
|
}
|
|
|
return [[[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:UIImageOrientationUp] autorelease];
|
|
|
}
|
|
|
return nil;
|
|
|
}
|
|
|
- (void)queryDiskCacheOperation:(NSDictionary *)arguments
|
|
|
{
|
|
|
NSString *key = [arguments objectForKey:@"key"];
|
|
|
NSMutableDictionary *mutableArguments = [[arguments mutableCopy] autorelease];
|
|
|
|
|
|
UIImage *image = [[[UIImage alloc] initWithContentsOfFile:[self cachePathForKey:key]] autorelease];
|
|
|
|
|
|
UIImage *image = [self imageForFile:key];
|
|
|
if (image)
|
|
|
{
|
|
|
#ifdef ENABLE_SDWEBIMAGE_DECODER
|
...
|
...
|
@@ -247,7 +259,7 @@ static SDImageCache *instance; |
|
|
|
|
|
if (!image && fromDisk)
|
|
|
{
|
|
|
image = [[[UIImage alloc] initWithContentsOfFile:[self cachePathForKey:key]] autorelease];
|
|
|
UIImage *image = [self imageForFile:key];
|
|
|
if (image)
|
|
|
{
|
|
|
[memCache setObject:image forKey:key];
|
...
|
...
|
|