Try OpenEdge Now
skip to main content
ABL Data Types Addenda
Using large objects in ABL : Using BLOB values and image files
 

Using BLOB values and image files

The following example also assumes that there is a new BLOB field (called employee.image) in the employee table that contains the employee's picture. The code reads the BLOB field and writes the data to a temporary file which the LOAD-IMAGE method reads:
DEFINE IMAGE PICTURE SIZE 10 BY 5.
DEFINE FRAME frameA picture.

DEFINE VAR picfile AS CHAR.

/* Find the employee record */
FIND FIRST employee WHERE FirstName EQ "John".
/* Create a temporary file to hold the image */
picFile = SESSION:TEMP-DIRECTORY + "\"
+ employee.NAME + ".jpg".
/* Copy the image from the blob field to the
* temporary file with COPY-LOB code */
COPY-LOB employee.image TO FILE picFile.

/* Associate the image with a button */

picture:LOAD-IMAGE(picFile) IN FRAME frameA.

/* Delete the temporary file */
OS-DELETE VALUE(picFile).