Log In    |    Knowledge Base    |    4D Home
Tech Tip: Loading a Picture from a File
Published On: September 10, 1999
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

It is possible to loading a picture into 4D using the DOCUMENT TO BLOB command and the 4D_Pack AP Read picture BLOB commands. The following code is an example for loading a picture:

Cut and Paste the following code example into your
own 4D project

$vhDocRef:=CLOSE DOCUMENT(Open document("")) ` Select the document of your choice
If (OK=1) ` If a document has been chosen
 DOCUMENT TO BLOB(Document;vBlob) ` Load the file
  If (OK=1) ` If the document has been loaded
  $error:=AP Read picture BLOB (vBlob;vPicture)
  If ($error#0)
   ALERT("An error has occurred.")
  End if
 End if
End if