(Visual FoxPro) Download Image (JPG, GIF, etc.) to Base64
Demonstrates how to download an image, or any type of file, to get the data in base64 encoding format.
LOCAL loHttp
LOCAL loBd
LOCAL lnSuccess
LOCAL lcBase64_image_data
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBd = CreateObject('Chilkat.BinData')
lnSuccess = loHttp.DownloadBd("https://www.chilkatsoft.com/images/starfish.jpg",loBd)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loBd
CANCEL
ENDIF
lcBase64_image_data = loBd.GetEncoded("base64")
? "image data in base64 format:"
? lcBase64_image_data
RELEASE loHttp
RELEASE loBd
|