-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting file path of image cached on disk #339
Comments
I'll second this, or alternatively a method similar to queryDiskCacheForKey that returns the bare NSData from the disk cache: - (void)queryOnlyDiskCacheForKey:(NSString *)key done:(void (^)(NSData *data, SDImageCacheType cacheType))doneBlock {
if (!doneBlock) return;
if (!key)
{
doneBlock(nil, SDImageCacheTypeNone);
return;
}
dispatch_async(self.ioQueue, ^
{
NSData *data = [NSData dataWithContentsOfFile:[self cachePathForKey:key]];
dispatch_async(dispatch_get_main_queue(), ^
{
doneBlock(data, SDImageCacheTypeDisk);
});
});
} |
I also would like SDWebImage to allow to get file path of image cached on disk. Exactly the same reason as @lammertw |
ya, I need this method too. |
I also need it. |
There are private SDImageCache methods to get filesystem path to image. Just make these methods public with category. Put the code below into the SDImageCache+Private.h and add it to your project:
|
If would be nice if there was an easy way to get the file path of an image that is cached on disk. It could be as easy as making the cachePathForKey: method in SDImageCache public.
The reason why I personally need it is for the UIDocumentInteractionController to share images with other apps. This class requires the file path to an image. Also it requires a png extension of the file.
The text was updated successfully, but these errors were encountered: