How to Store and Display a Graphic Image with a Memo or Blob Data Type

Top  Previous  Next

Memo and Blob variables are capable of storing large variable length chunks of binary data. This makes them suitable for storing graphic images. MEMOs are limited to 64K or less. BLOBS have no size limit. Storing and displaying images with Memo or Blob variables requires the following:

 

Storing Graphic Images in BLOBs or MEMOs

To store the graphic image into the MEMO or BLOB variable, channel it through an IMAGE control.

That is, assume the image resides in C:\IMAGES\IMAGE.BMP. We need to transfer the .BMP file to a CW IMAGE control, then transfer from the IMAGE control to the MEMO or BLOB variable.

1.

The BLOB or MEMO variable must have the BINARY attribute.

In the Data Dictionary, use the Field Properties dialog's General tab to set the Data Type to MEMO or BLOB, then check the Binary box.

2.

Assign the image file to an IMAGE control.

In the Image Properties dialog, in the File field, use the ellipsis (...) button to name the file containing the graphic image.

or

Assign the file name with Clarion's property syntax as follows:

?Image1{PROP:Text} = filename

3.

Transfer the image from the IMAGE control to the MEMO or BLOB variable using Clarion's property syntax:

For MEMOs:

CON:TheMemo = ?Image1{PROP:ImageBits}

For BLOBs:

CON:TheBlob{PROP:Handle} = ?Image1{PROP:ImageBlob}

 

Displaying Graphic Images from BLOBs or MEMOs

To restore (ie display) the image from a BLOB or MEMO to an IMAGE control, you must properly define the size of the IMAGE control. The IMAGE control must either be of Default size, or of a fixed size set after the MEMO or BLOB data is assigned to it.

1.

To set the IMAGE control to default size.

In the Image Properties dialog, on the Position tab, check the Default boxes for Height and Width.

2.

Use Clarion's property syntax to transfer the MEMO or BLOB data to the IMAGE control.

For MEMOs:

?Image2{PROP:ImageBits} = CON:TheMemo

For BLOBs:

?Image2{PROP:ImageBlob} = CON:TheBlob{PROP:Handle}

3.

After the MEMO or BLOB has been assigned to the IMAGE with property syntax, a fixed width and height may be assigned to the IMAGE Control:

   ?Image2{PROP:Width} = 92

   ?Image2{PROP:Height} = 88

 

The shipping SCHOOL example demonstrates using property assignments for images.