-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
How do I preload only images that are not in the cache ? #1006
Comments
Which one do you want to preload the original image or the resized image that will be shown? For SOURCE cache: use Glide assumes the same, the data doesn't change as long as the url is the same. |
As images might be used in different places it's better to cache original images. But as they might not be bigger than screen I'm scaling then to screen size in order to save some space on disc. But it seems that it does not read preloaded images if thay are scaled to different size than ImageView requires. For instance most of images are 1440x2560 but a lot of devices have 1080x1920 so there is a big overhead by saving raw image. But if I scale it to 1080x1920 and than load it into view 1000x1000 it seems it does not take image from cache. |
These sounds really abstract operations, can you please share your Glide snippets? But before you do, try to check why the cache is not hit: https://github.com/bumptech/glide/wiki/Debugging-and-Error-Handling#debugging-workflow Note that SOURCE cache doesn't store raw images, it stores the original, and if it's a compressed JPEG, they it stays that way. Note that this kind of speculation and size handling is one of the strength of Glide. You just throw stuff at it and it'll make sure it uses the least amount of processor and memory on account of a little disk space. If you have one size use the default RESULT caching; and if you load a single image multiple times in different views, use ALL caching. |
Please reopen if you need more help. |
I'm trying to pre-fetch some images for better performance on some screens with
preload()
method. But I'm not sure if it invalidates items that are already in the cache. I would like topreload these items only if they are not in the cache as I know that image is not changed as long as url is the same but docs does not say anything about this.Could you please clarify this ?
Thanks.
The text was updated successfully, but these errors were encountered: