ImageEn, unit iexDBBitmaps

TIEDBMultiBitmap


Declaration

TIEDBMultiBitmap = class(TIECustomMultiBitmap);


Description

TIEDBMultiBitmap is a descendant of TIECustomMultiBitmap, but unlike TIEMultiBitmap it links to a datasource to provide access to images stored in a database table.
Generally a TIEDBMultiBitmap is attached to a TImageEnMView to make it DB aware.

TIEDBMultiBitmap 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 also need to set DataSource.

TIEDBMultiBitmap can operate in two modes:
- Showing all images in a table (the multi-bitmap will contain one image per table record)
- Showing an image with one or more frames at the current database position (the multi-bitmap will show the image for one database record, which may have multiple frames, e.g. a TIFF)

You can also use TIEDBMultiBitmap to retrieve an image (optionally with multiple frames, like a TIFF) embedded in a database blob field using the data-aware overload of Read.

// Extract an image from a database and save it
MyMBMP := TIEDBMultiBitmap.Create();
MyMBMP.Read( MyTableImageBlob );
MyMBmp.Write( 'D:\MyBlobImage.TIFF' );
MyMBmp.Free;


Demos

Demo Description Demo Project Folder Compiled Demo
Database Thumbnail Viewer Use of FireDAC and a TIEDBMultiBitmap to make a data-aware TImageEnMView that displays thumbnails of all images in a database table \Demos\Database\DBMultiBitmap_AllRecords\DBMultiBitmapFD.dpr   
Database Multi-Frame Demo Use of FireDAC and a TIEDBMultiBitmap to make a data-aware TImageEnMView that displays a multi-frame image at the current position of a database table \Demos\Database\DBMultiBitmap_MultiFrame\DBMultiBitmapFD2.dpr   


Example

// Create DB Aware TImageEnMView
procedure TMainForm.FormCreate(Sender: TObject);
begin
  ... Open a database table ...

  fDBMBitmap := TIEDBMultiBitmap.create( DataSource1, 'Image', 'Name' );
  ImageEnMView1.SetExternalMBitmap( fDBMBitmap );
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  FreeAndNil( fDBMBitmap );
end;


Methods and Properties

General
Public Method  Create
Public Method  Destroy
Public Property  Count
Public Method  LockUpdate
Public Property  LockUpdateCount
Public Property  Modified
Public Method  UnlockUpdate

Database - General
Public Property  DataSource
Public Property  FilenameField
Public Property  ImageBlobField
Public Property  ImageFormat
Public Property  ImagePath
Public Property  ImageStorageMode
Public Property  Mode
Public Method  SetActiveImage
Public Method  Update
Public Property  UseMemoryStream

Database - All Records Mode
Public Property  FilenameFieldIsUnique
Public Property  FollowDBCursor
Public Property  MaxDisplayRecords

Database - Record Frames Mode
Public Property  AutoLoad
Public Method  Read (Load from blob/file/stream)
Public Method  Write (Save to blob/file/stream)
Public Method  LoadImage
Public Method  UpdateDatabaseImage

Database Editing
Public Method  AppendImage
Public Property  DefaultFilename
Public Method  DeleteImage
Public Method  InsertImage
Public Property  JpegQuality
Public Property  ReadOnly

Image Access
Public Method  CopyToIEBitmap
Public Method  GetBitmap
Public Method  GetTIEBitmap
Public Method  ReleaseBitmap
Public Method  SetImage

Image Information
Public Property  ImageBitCount
Public Property  ImageFilename
Public Property  ImageHeight
Public Property  ImageTag
Public Property  ImageUserPointer
Public Property  ImageWidth

Input/Output
Public Property  ImageCacheSize
Public Property  ImageCacheUseDisk
Public Method  GetImageToFile
Public Method  GetImageToStream

Input/Output Parameters (Meta-Data)
Public Method  DuplicateCompressionInfo
Public Property  ParamsEnabled
Public Property  Params

Image Manipulation
Public Method  Flip
Public Method  Resample
Public Method  Rotate

Events
Event  OnChanged
Event  OnLoaded
Event  OnImageLoaded
Event  OnProgress

 Unique functionality to TIEDBMultiBitmap