get images from internet

BlitzPlus Forums/BlitzPlus Programming/get images from internet

meemoe_uk(Posted 2013) [#1]
Hi I understand the basics of using OpenTCPStream to get text from the internet. But I'd like to get images. Is there a way to do that?


_PJ_(Posted 2013) [#2]
You need to send a 'GET' message in stream to the server and then, when authorised, read and write the bytes of the stream to a local file.

Once downloaded, you then need to Load the file back as an Image into Blitz (with LoadImage()), and so the local filepath should have the same extension as the online image (I,e. jpg or png )

This is a good example code:
http://www.blitzbasic.com/codearcs/codearcs.php?code=2952


meemoe_uk(Posted 2013) [#3]
thanks!
i tried it on a few random web images.
Some it worked for. For others it failed for various reasons, possibly to do with local variations in html and tcp protocol. Need to look into that next.