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

Getting images as an input stream #2803

Closed
AllanWang opened this issue Jan 10, 2018 · 2 comments
Closed

Getting images as an input stream #2803

AllanWang opened this issue Jan 10, 2018 · 2 comments
Labels

Comments

@AllanWang
Copy link

I'm using another library to load images through a file so that images may be loaded in parts in its full resolution, and be zoomable.

In short, the only output I need is to a file, and the image may be large.

I'd like to make use of some form of caching so that such large files are not downloaded each time.
However, Glide's targets seem to be namely for drawables or bitmap, and asFile seems to be for local files rather than downloading to a file.

Is there any output that targets an input stream or any other format that doesn't load everything at once?

@AllanWang
Copy link
Author

I'll leave this up for discussion for now, but it seems like OkHttp + saving the file with the name as the url hash + clearing out the directory for files older than xxx minutes seems to be alright

@sjudd
Copy link
Collaborator

sjudd commented Jan 12, 2018

http://bumptech.github.io/glide/javadocs/450/com/bumptech/glide/RequestManager.html#download-java.lang.Object- will work to get just a File object for a remote image.

In general it's better to use Glide as an image loading library and use a networking library like OkHttp as you've suggested to manage downloads. If they overlap and you sometimes want the file and sometimes want to load the image or thumbnails of the image, using Glide can make sense.

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

No branches or pull requests

2 participants