ImageEn, unit iexDBBitmaps

TIEDBMultiBitmap.SetImage

TIEDBMultiBitmap.SetImage


Declaration

procedure SetImage(idx: Integer; srcImage: TIEBaseBitmap); overload;
procedure SetImage(idx: Integer; srcImage: TBitmap); overload;
procedure SetImage(idx: Integer; width, height: Integer; PixelFormat: TIEPixelFormat); overload;
function SetImage(idx: integer; const FileName: WideString; SourceImageIndex: Integer = 0; FileFormat: TIOFileType = ioUnknown): boolean; overload;
function SetImage(idx: Integer; Stream: TStream; SourceImageIndex: Integer = 0; FileFormat: TIOFileType = ioUnknown): Boolean; overload


Description

Updates the current image in the database table. If images are stored in the database (i.e. ImageBlobField is set), the image will be updated in the blob. If images are stored as files referenced by the database (i.e. ImageBlobField is NOT set), the image changes will be saved to file (using DefaultFilename and without an overwrite warning).

Note:
idx should be set to -1. Unlike TIEMultiBitmap.SetImage, TIEDBMultiBitmap.SetImage always works on the CURRENT database table record.
If Mode = dmRecordFrames, this method only replaces a frame of the current image and does NOT update the database. You will need to call UpdateDatabaseImage

With overloads 2 and 3 the srcImage bitmap is copied internally; therefore you can free srcImage after calling SetImage.
With overload 4 the image can be a local file or web page based image.
With overloads 3 and 4 use SourceImageIndex to specify the image index if the source file is a multi-frame file (such as a TIFF or AVI). You can also specify the FileFormat if it cannot be determined by the file extension or content.

TDataset.Edit and TDataset.Post are NOT called (Unlike AppendImage and InsertImage)


Examples

ImageEnView1.IO.LoadFromFile('C:\000.tif');
MBitmap.InsertImage( 0 );
MyTable.Edit;
MBitmap.SetImage( -1, ImageEnView1.IEBitmap );
MyTable.Post;

MyTable.Edit;
MyTableFilename.AsString := 'My Cool Image.jpg';
ImageEnMView1.SetImage( -1, stream );
MyTable.Post;

MyTable.Edit;
MyTableFilename.AsString := 'myfile.jpg';
ImageEnMView1.SetImage( -1, 'D:\myfile.jpg' );
MyTable.Post;

MyTable.Edit;                    
MyTableFilename.AsString := 'My Web Image';
ImageEnMView1.SetImage( -1, 'http://www.imageen.com/graphics/imageen.gif' );
MyTable.Post;


See Also

InsertImage
AppendImage
DefaultFilename