Closed chatumoh closed 3 years ago
Hey, this is correct, image files are stored with generated names and file extensions from UTI. Metadata, such as identifier, stored in file record in the file index database. So you first need to query the database and then you can get the file path. See DiskCache
object.
If you need to get the image without displaying it in a view, recommended way is to use RemoteImage
as described in Download an Image Without a View section. Use .returnCacheDontLoad
policy if you don't want to download the image and only fetch it from disk.
This may not be the most convenient way, and I'm planning to introduce better APIs for this.
Closing the issue. Feel free to reopen if you have more questions.
Summary and/or background Remote Image not stored in cache with identifier provided in URLImageOptions
Version of URLImage library Version used- 2.1.13
What you expected would happen Per documentation i am getting cache url of dowloaded image via
URLImageService.shared.diskCacheURL
What actually happens I am trying to download images via vendor URL & show it in each row of list on app load. Next i have feature to set up local notification in app. so i want to attach image dowloaded to cache , with notification.
I tried to load image url from cache using
URLImageService.shared.diskCacheURL.appendingPathComponent("img-logo")
but i verified in cache images are saved with UUID string instead of identifier provided in URLImageOptions. Am i doing something wrong here ?Sample code
URLImage(url: URL(string: "https://.../../logo.png")!, options: URLImageOptions(identifier: "img-logo"), content: { image in image .resizable() .aspectRatio(contentMode: .fill) .clipped() })