ImageEn, unit iexDBBitmaps |
|
TIEDBMultiBitmap.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 a TMemoField.
TIEDBMultiBitmap 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). It will also improves performance, especially if the
filename field is unique.
◼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
ImagePathNote:
- Either
ImageBlobField or
FilenameField must be set (or both).
- You should set
FilenameFieldIsUnique if the field is unique to improve performance
See Also
◼ImagePath◼FilenameFieldIsUnique◼ImageBlobField◼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;