Hi all,
Wondering if it would be possible to throw support for Data URLs into the juce::URL
class at some point?
I’m just working on adding better image loading support to @ncthom’s Blueprint library. juce::URL
is most convenient for us when it comes to loading images using file://
URLs or network resources but we’ve had to special case for Data URLs.
See the comments on this PR for details: https://github.com/nick-thompson/blueprint/pull/110.
Code example:
if (sourceURL.isWellFormed())
{
auto drawableImg = std::make_unique<juce::DrawableImage>();
drawableImg->setImage(loadImageFromURL(sourceURL));
drawable = std::move(drawableImg);
}
else if (source.startsWith("data:")) // Sadly JUCE does not currently handle "data:" URLs
{
auto drawableImg = std::make_unique<juce::DrawableImage>();
drawableImg->setImage(loadImageFromDataURL(source));
drawable = std::move(drawableImg);
}
Data URLs aren’t something I’m overly familiar with but I’d be happy to take a stab at this and drop a PR for someone to trash if needed.
Cheers,
Josh