ImageEn, unit iexDBBitmaps

TIEDBBitmap.ImageBlobField

TIEDBBitmap.ImageBlobField


Declaration

property ImageBlobField : string;


Description

Specifies the database blob field that embeds image files. It must be the name of a TBlobField.

TIEDBBitmap can be used in two ways:
 Reading images directly from a database blob field
 Reading files stored in a local folder and referenced by a database string field

If ImageBlobField is not set then images will be loaded locally (using FilenameField)
If ImageBlobField is a valid field, then images will be read from the embedded blob field. The file format will be determined using ImageFormat. You can optionally set FilenameField to specify a field with a display name for the image.

Note: Either ImageBlobField or FilenameField must be set (or both).


Examples

// Display content of a table where images are stored in a blob field
fDBBitmap := TIEDBBitmap.create();
fDBBitmap.DataSource := DataSource1;
fDBBitmap.ImageBlobField := 'ImageBlob';
ImageEnView1.SetExternalBitmap( fDBBitmap );

// Display content of a table where images are stored in a blob field and name of image is stored in "ImageName" field
fDBBitmap := TIEDBBitmap.create();
fDBBitmap.DataSource := DataSource1;
fDBBitmap.FilenameField := 'ImageName';
fDBBitmap.ImageBlobField := 'ImageBlob';
ImageEnView1.SetExternalBitmap( fDBBitmap );

// Display content of a table where images are stored in a folder and their path and filename is referenced by the "ImageFilename" field
fDBBitmap := TIEDBBitmap.create();
fDBBitmap.DataSource := DataSource1;
fDBBitmap.FilenameField := 'ImageFilename';
ImageEnView1.SetExternalBitmap( fDBBitmap );

// Display content of a table where images are stored in a folder named "My Folder" and their filename is referenced by the "ImageName" field
fDBBitmap := TIEDBBitmap.create();
fDBBitmap.DataSource := DataSource1;
fDBBitmap.ImagePath  := 'C:\My Folder\';
fDBBitmap.FilenameField := 'ImageName';
ImageEnView1.SetExternalBitmap( fDBBitmap );


Note: Don't forget to free the object...
procedure TMainForm.FormDestroy(Sender: TObject);
begin
  FreeAndNil( fDBBitmap );
end;


See Also

 ImageFormat
 FilenameField
 ImageStorageMode