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
Using cache key to load image with ui image view #2181
Comments
My current work around: |
You can create an image resource with a customized cache key and load it: let resource = KF.ImageResource(downloadURL: url, cacheKey: "my_cache_key")
imageView.kf.setImage(with: resource) |
The thing is, the images are not being downloaded in the first place, but manually cache them, then try to set them onto image view through imageView.kf.setImage. As you know setImage does not take cache key, that I used to cache the image. I tried using KF.ImageResource but I don't have a url for the image, and I think the resource here is used to download and cache image under specific key. All in all, just note that I am not downloading the images but trying to use imageView.kf.setImage in order to take advantage of the options param. |
If there is already a place to load the image (and you will always have it locally), then maybe instead of the Check this for detail: https://github.com/onevcat/Kingfisher/wiki/Cheat-Sheet#imagedataprovider Or as long as you can get the raw data of the image somewhere, you can also create your own data provider. If you only have the local image transiently, and in the future there might be a chance you need to load it from a remote URL, then you can firstly manually cache it in the |
Is there an ImageDataProvider to load an image from kingfisher cache? If yes, kindly comment. I only know of LocalFileImageDataProvider, which loads from app files. |
Hi Guys,
I am using kingfisher in a messaging app, and I would like to know how to load images with ui image view (not to retrieve) using a cache key. So this is what happens:
I want to load image onto image view using cache key, so that I can make use of .keepCurrentImageWhileLoading, .loadDiskFileSynchronously.
I cannot use url as image is not downloaded. I saw that there is a way to use a LocalFileImageDataProvider, but in this case the image a stored using kingfisher.
Thanks.
The text was updated successfully, but these errors were encountered: