ImageEn, unit iexDBBitmaps

TIEDBBitmap.FilenameField

TIEDBBitmap.FilenameField


Declaration

property FilenameField : string;


Description

Specifies the database field that contains the name or filename of the image. It must be the name of a TStringField or TMemoField.

TIEDBBitmap can be used in two ways:
Reading images directly from a database blob field, by setting ImageBlobField to a valid field. In this situation FilenameField specifies a display name for the image (and is optional).
Reading files stored in a local folder and referenced by a database string field, by setting ImageBlobField to ''. In this case FilenameField should either be a full path to a local file, or a name only with the folder specified by ImagePath

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

ImagePath
ImageBlobField
ImageStorageMode