fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Custom Uri handlers / accepting arbitrary InputStreams

Open mcginty opened this issue 11 years ago • 11 comments

The current Uri handlers are great for many cases, but in our app (and many others) we store our media encrypted on disk. Because of this, vanilla ContentProviders are unavailable as an option as we'd have to write a temporary unencrypted version to disk (ewww). The other option in Fresco would be to setup a localhost HTTP server that streams the unencrypted version (ewwwwww), which is a lot of unnecessary overhead.

If, however, Fresco allowed additional custom Uri handlers that provide InputStreams, we'd be golden. Alternatively, having a setImageInputStream alongside setImageUri would also suffice.

mcginty avatar Mar 26 '15 23:03 mcginty

We are thinking of supporting something very similar (basically either a custom uri handler or specifying InputStream Supplier while building image request).

plamenko avatar Mar 27 '15 18:03 plamenko

I was going to say exactly the same thing...our app has data stored on disk in encrypted form as well. It's only unencrypted when in the in-memory cache. Thanks for supporting this soon @plamenko :-)

We also need a way to change the disk data (e.g., user edits a document/photo and writes it to disk, so the cache has to update)...

kenyee avatar Mar 28 '15 20:03 kenyee

I'll have to refactor some of the fetching logic to make this plugin-like, but hopefully I'll get to this some time soon.

plamenko avatar Apr 17 '15 00:04 plamenko

I'm running into this same issue. I'd like to use this in conjunction with Conceal or another file encryption mechanism which provides an InputStream.

ashughes avatar May 19 '15 01:05 ashughes

@plamenko is there a timeline on this or any way I can "help" or use an InputStream with the current API? We would like to use in this app https://play.google.com/store/apps/details?id=fm.clean for its internal Gallery.

agirardello avatar Jul 23 '15 08:07 agirardello

I`m running into this issue too. I think we can use content provider. See http://frescolib.org/docs/supported-uris.html#_ Fresco support "content:" like url. so we can make a content provider and do decrypt in it at first. and then set uri "content:xxx?id=xxx&key=xxx" to drawee.

caojianfeng avatar Oct 15 '15 06:10 caojianfeng

@caojianfeng do you have an example code for that content provider?

anotherdev avatar Nov 05 '15 11:11 anotherdev

@plamenko any update regarding a custom Uri handler?

sohayb avatar Mar 16 '17 07:03 sohayb

I don't think we're likely to get to this any time soon. If someone would like to offer a pull request, I'd be willing to offer support.

We're currently cleaning up old issues which aren't progressing but I'll leave this a little longer in case anyone is interested in pursuing this.

kirwan avatar Aug 31 '17 13:08 kirwan

Closing this as part of our cleanup of old issues.

If anyone requires this feature, please consider implementing it and submitting a pull request.

erikandre avatar Jan 15 '18 14:01 erikandre

I don't think we're likely to get to this any time soon. If someone would like to offer a pull request, I'd be willing to offer support.

As I understand it, nothing was implemented in the end?

AntDev95 avatar Sep 01 '20 21:09 AntDev95