ImageEn, unit iexDBBitmaps |
|
TIEDBBitmap
Properties · Methods · Events · Demos
Declaration
TIEDBBitmap = class(TIEBitmap);
Description
TIEDBBitmap is a descendant of
TIEBitmap, but it links to a datasource to provide access to images stored in a database table.
TIEDBBitmap supports both images stored within the database as a blob (by setting
ImageBlobField) or images stored locally and referenced by a filename field (by setting only
FilenameField). You will need to set
DataSource.
There are two ways you can use TIEDBBitmap:
• Connected to a TTableBy setting the
DataSource and
ImageBlobField or
FilenameField, the TIEDBBitmap will be connected to the database and the content will update with the movement and changes on the table, either automatically (
AutoLoad is true) or manually (by calling
LoadImage). This is generally used to create a data-aware
TImageEnView by setting the
external bitmap to a TIEDBBitmap.
// Create DB Aware TImageEnView
procedure TMainForm.FormCreate(Sender: TObject);
begin
... Open a database table ...
fDBBitmap := TIEDBBitmap.create( DataSource1, 'Image', 'Name' );
ImageEnView1.SetExternalBitmap( fDBBitmap );
end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
FreeAndNil( fDBBitmap );
end;
• As an adhoc Bitmap with database accessUse TIEDBBitmap to retrieve images embedded in a database blob field using the data-aware overload of
Read.
// Extract an image from a database and save it
MyBMP := TIEDBBitmap.Create();
MyBMP.Read( MyTableImageBlob );
MyBmp.Write( 'D:\MyBlobImage.jpeg' );
MyBmp.Free;
Demo | Description | Demo Project Folder | Compiled Demo |
Simple Database Demo | Display of an image stored within a database blob field of the active record using FireDAC and a TIEDBBitmap | Database\DBDemo_Simple\DBBitmapFD.dpr | |
Database Demo | Display and editing of an image stored within a database blob field using FireDAC and a TIEDBBitmap | Database\DBDemo\DemoDB.dpr | |
Database Path Demo | Display of a locally stored image referenced by a path field in a database using FireDAC and a TIEDBBitmap | Database\DBPath\DBPath.dpr | |
Database Layers Demo | Adding annotations to an image stored within a database blob field using FireDAC and a TIEDBBitmap | Database\DBDemo_Layers\DBDemoLayers.dpr | |
GeneralDatabaseAssignment between ObjectsInput/OutputCanvas AccessAlpha Channel (Transparency)Pixel AccessPalette and ColorImage EditingEvents Unique functionality to TIEDBBitmap