Thoughts on built-in data Url support
nsk-mironov opened this issue · comments
Is your feature request related to a problem? Please describe.
We're currently migrating our app from Fresco to Coil and there is one nice Fresco feature that we miss in Coil. Fresco has a built-in support for Data Url Scheme, which allows you to encode the entire image directly into the url.
Describe the solution you'd like
It's actually quite easy to support such urls using custom coil.fetch.Fetcher.Factory
and we've already implemented such Fetcher
in our codebase. The question is - what do you think on having a built-in support for data urls? In case you're ok with it, I would be more than happy to make a pull request that brings DataUriFetcherFactory
directly to the library.
Additional context
- Data Url format -
data:[<mediatype>][;base64],<data>
- Data Url specification - https://datatracker.ietf.org/doc/html/rfc2397
- Related Fresco implementation - DataFetchProducer
Do you know how often these types of URLs are used on Android? Coil already supports ByteArray
s and ByteBuffer
s for decoding data that's already in memory.
Also do you know if the Android system can return these type of URIs from any system functions or supports them in ImageView
s? That's usually my guideline for whether Coil should add support.
Thanks for the suggestions, however I'm going to close this out as there doesn't seem to be a lot of demand for this feature. Including it in the base library increases the library size for all users so we have to be careful about adding new core fetchers.