I show the user an image in a modal and want to allow download of the image (without having to save it server side first) but am having issues.
The image data is base64 and stored in an SQLite db and I am using the below code to actually show the image (shown here with the debugger showing the image data string):
NOTE: I have tried removing the ‘header’ string info “data:image/png;base64,” but still get a file that is reportedly not recognised. Below is the code I am using for this:
// download current image
imgfile = new WebFile
imgfile.Filename = "image.png"
imgfile.MIMEType = "image/png"
imgfile.ForceDownload = true
'dim p as picture = StringToPicture(largeImg1.imgdata)
'if p <> nil then
imgfile.data = largeImg1.imgdata //imgdata is a string (of the type data:image/png;base64, (but have tried removing this 'header'))
showurl imgfile.URL
' end if
Any thoughts ?
EDIT: DecodeBase64 first I guess ?