QB64 Phoenix Edition
Sample of _LOADIMAGE change - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7)
+---- Thread: Sample of _LOADIMAGE change (/showthread.php?tid=1490)



Sample of _LOADIMAGE change - SMcNeill - 02-20-2023

Code: (Select All)
$Unstable:Http

Screen _NewImage(800, 600, 32)

logo$ = "https://qb64phoenix.com/qb64wiki/resources/assets/peWikiLogo.png"
image$ = Download$(logo$, foo&)

imagehandle = _LoadImage(image$, 32, "memory")

_PutImage , imagehandle



' Content of the HTTP response is returned. The statusCode is also assigned.
Function Download$ (url As String, statusCode As Long)
    h& = _OpenClient("HTTP:" + url)
    statusCode = _StatusCode(h&)
    While Not EOF(h&)
        _Limit 60
        Get #h&, , s$
        content$ = content$ + s$
    Wend
    Close #h&
    Download$ = content$
End Function


Note:  This requires version 3.6 or above to run!


RE: Sample of _LOADIMAGE change - mnrvovrfc - 02-21-2023

Wow! It's that simple. I recall all manner of things done to the poor bee of the old forum LOL.