LoadImage from web
BlitzMax Forums/BlitzMax Beginners Area/LoadImage from web
| ||
Hi, I try to load an image from my webserver, but my program hangs all the time. :-/ Local URL:String = "http://www.mywebsite.com/sprite.png" Local Img:TImage = LoadImage(URL) DrawImage Img,0,0 Img returns NULL, so the image is not loaded. If I locally load an image, it all works fine. Any ideas? - Oliver |
| ||
You need to use the prefix http::Local URL:String = "http::www.mywebsite.com/sprite.png" Local Img:TImage = LoadImage(URL) DrawImage Img,0,0 |
| ||
Ah, thanks! That helped. :-) |
| ||
you'll probalby want to make sure that it has loaded before you use if though, otherwise your app will just crash! Cheers Charlie |
| ||
Note that some image formats can't be loaded directly, since the imageloader tries to seek in the stream... But you can get all of them work with one additional step:Local pic:TImage=LoadImage(LoadBank("http::www.blitzbasic.com/img/brllogo-thin.png")) That way the image is downloaded into a seekable memorybank first, before being passed on to the LoadImage function. |