load image from internet
BlitzMax Forums/BlitzMax Beginners Area/load image from internet
| ||
| Is it possible to load an image from the intenet and use it as an image in a blitzmax application? If so, how. I tried: global playerImage=loadimage("http::temp.macdock.com/charliesgames/BCG/blueflat.bmp") but that didn't work. Cheers Charlie |
| ||
| This? |
| ||
| Thanks |
| ||
| Hey I can't get any of that original code to work in 1.22. Any clues? And in SuperStrict? (From Xlsior's, from Skid's originally)
Graphics 400, 300, 0
DrawText "Getting Image...", 140, 144
Flip
img:TImage = LoadImage(LoadBank("http::www.domain.com/images/image.jpg"))
If Not img Then RuntimeError "Unable to download image"
'Graphics img.width, img.height, 0
Graphics 1024,768
DrawImage img, 0, 0
Flip
WaitKey()
End
|
| ||
| Does the image exist? The two graphics commands probably don't help. Try this Graphics 800,600
img:TImage = LoadImage(LoadBank("http::www.blitzbasic.com/img/brllogo-thin.png"))
If Not img Then RuntimeError "Unable to download image"
DrawImage img, 0, 0
Flip
WaitKey()
End |
| ||
| Yeah it exists as far as I can tell, and its updated every 15 min or so. ;) http: //www.ssec.wisc.edu/data/west/latest_westir.jpg @tonyg - The code you suggested still fails and says "unable to download image". Anyone having any luck? This worked back on the old versions of Blitz, not sure where I'm failing the IQ test. If anyone else IS able to get the code working to load and display an image, I'd really appreciate any help! @jkrankie - Did you get it to work? Lemme know!! |
| ||
| Did you get the same error using the brllogo-thin.jpg? Trying the image from your example I get the 'unable to download image' message. However, when pasting the url I get a registration page. |
| ||
| No I didn't get the same error using the brllogo-thin.jpg.! Hmmmm. Wierd. Pretty confused at this point. Tried a couple other direct links to images, even one from my own site. Same thing, unable to load image. Lame! :( |
| ||
| (From Xlsior's, from Skid's originally) LOL...Is this some sort of conspiracy? |oDWorks fine here? Graphics 400, 300, 0
DrawText "Getting Image...", 140, 144
Flip
img:TImage = LoadImage(LoadBank("http::www.ssec.wisc.edu/data/west/latest_westir.jpg"))
If Not img Then RuntimeError "Unable to download image"
Graphics img.width, img.height, 0
DrawImage img, 0, 0
Flip
WaitKey()
End |
| ||
| Yep, that works for me as well but then I *can* see that image if I paste the URL and change to http:// |
| ||
| But that's what Booticus was trying to load, wasn't it? I'm confused... 8o/ |
| ||
| That's the image but you've used a different url. |
| ||
| Yeah Im trying to load that satellie image and save out "sanpshots" to the drive. I can see the image if I paste the URL into Firefox, of course, but within Blitz it fails out on me. Still scratching my head at this one.... |
| ||
| DUDE. Its working on my laptop here at work just fine now! But I RDC'd into my box at home, compiled, and it still errors out! :) Ah well, just chalking this one up to "wierdness occurence" and leaving it alone. |
| ||
Does a straight dump of the bank work at home...Graphics 400, 300, 0
DrawText "Getting Image...", 140, 144
Flip
bank:TBank = LoadBank("http::www.ssec.wisc.edu/data/west/latest_westir.jpg")
If Not bank Then RuntimeError "Unable to download image"
SaveBank(bank, RequestFile("Save Image...", "JPG files:jpg", True))
End(just to rule out LoadPixmapJpeg())?? |
| ||
Damn Yan! That was it. I ran FrameworkAssistant and put the items in and it works!!!!
Framework brl.GLMax2D
Import brl.Max2D
Import brl.HTTPStream
Import brl.JPGLoader
' modules which may be required:
' Import BRL.PNGLoader
' Import BRL.BMPLoader
' Import BRL.TGALoader
Graphics 400, 300, 0
DrawText "Getting Image...", 140, 144
Flip
img:TImage = LoadImage(LoadBank("http::www.ssec.wisc.edu/data/west/latest_westir.jpg"))
If not img Then RuntimeError "Unable to download image"
Graphics img.width, img.height, 0
DrawImage img, 0, 0
Flip
WaitKey()
End
|
| ||
| OH, PS I'll remove the actual link to the image, wonder if the site that I'm linking to is getting a lot of hits because of it. :) |
| ||
| The readstream example might help and loadimage takes an http:: address for images. |