ImageEn, unit iexDBBitmaps |
|
TIEDBMultiBitmap.ImageBlobField
Declaration
property ImageBlobField : string;
Description
Specifies the database blob field that embeds image files. It must be the name of a TBlobField.
TIEDBMultiBitmap 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. Setting
FilenameField will also improve performance, especially if the
filename field is unique.
Note: Either
ImageBlobField or
FilenameField must be set (or both).
See Also
◼ImageFormat◼FilenameField◼ImageStorageMode// Display content of a table where images are stored in a blob field
fDBMBitmap := TIEDBMultiBitmap.create();
fDBMBitmap.DataSource := DataSource1;
fDBMBitmap.ImageBlobField := 'ImageBlob';
ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
// Display content of a table where images are stored in a blob field and name of image is stored in "ImageName" field
fDBMBitmap := TIEDBMultiBitmap.create();
fDBMBitmap.DataSource := DataSource1;
fDBMBitmap.FilenameField := 'ImageName';
fDBMBitmap.ImageBlobField := 'ImageBlob';
ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
// Display content of a table where images are stored in a folder and their path and filename is referenced by the "ImageFilename" field
fDBMBitmap := TIEDBMultiBitmap.create();
fDBMBitmap.DataSource := DataSource1;
fDBMBitmap.FilenameField := 'ImageFilename';
ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
// Display content of a table where images are stored in a folder named "My Folder" and their filename is referenced by the "ImageName" field
fDBMBitmap := TIEDBMultiBitmap.create();
fDBMBitmap.DataSource := DataSource1;
fDBMBitmap.ImagePath := 'C:\My Folder\';
fDBMBitmap.FilenameField := 'ImageName';
ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
Note: Don't forget to free the object...
procedure TMainForm.FormDestroy(Sender: TObject);
begin
FreeAndNil( fDBMBitmap );
end;