Skip to content
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

Resizing strategy #92

Closed
RuiAAPeres opened this issue Aug 10, 2015 · 2 comments
Closed

Resizing strategy #92

RuiAAPeres opened this issue Aug 10, 2015 · 2 comments

Comments

@RuiAAPeres
Copy link

After downloading an image, I would like to cache a resized version of it (thumbnail). Am I right to assume the best approach for this would be to:

1- Not use the KingfisherManager.swift
2- Create my own Manager that uses ImageCache.swift and ImageDownloader.swift and inject this logic in a method "similar to this".

@onevcat
Copy link
Owner

onevcat commented Aug 11, 2015

There is no need to do so. You can just use ImageCache separately. You could just throw your thumbnail to the default cache (KingfisherManager.sharedManager.cache) by calling storeImage:forKey: with a key different from your original file. Of course, you can create a new cache object to store these thumbnail if you do not want to mess it up with the default cache. It depends on you.

When you need to access these thumbnails, you could use retrieveImageForKey:options:completionHandler:. If there is no such cached image there, you will get nil and then you know you should download it from web.

@RuiAAPeres
Copy link
Author

Thanks for the feedback @onevcat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants