Loading Images from a URL?


#1

Id like to dynamicaly load or stream images to my app from a url whats the best way to go about it?

Ive tried:

[code]URL theurl(someurlwithimage);

InputStream *input = theurl.createInputStream(true);

Image* im = ImageFileFormat::loadFrom(input);[/code]

but get the following errors:

'juce::ImageFileFormat::loadFrom' : none of the 3 overloads could convert all the argument types

The manual indicated createInputStream can create InputStream that is perfectrly acceptable by loadFrom, whats going on?


#2

do you mean “loadFrom (*input)”, perhaps…?


#3

K, silly me…Typo…But I could swear I tried that, anyway its ok now:)


#4

Why it not load some image in Juce4? I have app was created Juce3.1. When i upgrade to juce 4.1 some images not load.  createInputStream return NULL; sad
 


#5

We never return NULL, we only return nullptr :)

But seriously, this thread is from 9 years ago! And if you want us to actually help with your problem you'd need to give us more info than just saying that some unknown code of yours doesn't work on some URLs..


#6

Of cource, nullptr... But.

Code like in 1st message but createInputStream(false). And this some images load and some not load. I dont have idea why .... Mac OS X 10.11. XCode 7.1 C++14/libc++ . On Windows its ok (Win10 VS2015)


#7

Sorry, but i think i found problem... "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."


#8

This thread and this thread.


#9

Yes ,thanks! But I have already found a solution ;)


#10