I'm trying to create a roBitmap from a downloaded image file, but it isn't working. Here's the code snippet:
sTempFile = "tmp:/temp.jpg"
UT=CreateObject("roUrlTransfer")
UT.SetUrl(sUrl)
iResult = UT.GetToFile(sTempFile)
print "Download status code: "; iResult
if (FileExists(sTempFile) = true) then
print "Downloaded media file exists"
else
print "Downloaded media file does NOT exist"
end if
img1 = CreateObject("roBitmap", sTempFile)
if (img1 = Invalid) then
print "roBitmap Invalid!"
end if
'Does file exist
Function FileExists(file as String) as Integer
fs = CreateObject("roFileSystem")
If fs.Exists(file) Then
stats = fs.Stat(file)
print "Type = ";stats.type;", size="; stats.size
return 1
End If
return 0
end function
And here is the result:
Download status code: 200
Type = file, size= 2994370
Downloaded media file exists
roBitmap Invalid!
Any idea on why this doesn't work? Or is there an error code somewhere I can check for more detail?
BTW, I'll switch to the async version once I get this working.
Thanks