KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Download pictures from the Internet
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: June 22, 2012

Starting in 4D v13, download a picture from the Internet can be done easily with the new HTTP Get command. The following is the generic method that can be used to download a picture into 4D application.

// Method: HTTP_DownloadPicture
// Parameters
// $1 - URL to a picture
// $2 - Pointer to a picture variable
// ----------------------------------------------------


C_TEXT($1;$body_t)
C_POINTER($2)
C_PICTURE($picture_pic)
C_LONGINT($httpResponse_l)
If (Count parameters>=2)
  $body_t:=$1
  $httpResponse_l:=HTTP Get($body_t;$picture_pic)
  $2->:=$picture_pic
End if


Example:

$url_t:="http://kb.4d.com/css/images/logo4D.jpg"
HTTP_DownloadPicture ($url_t;->$picVar)