function Write(): boolean; overload; function Write(aBlobField: TBlobField; FileType: TIOFileType; IOParams: TIOParams = nil): boolean; overload; function Write(const FileName: string; IOParams: TIOParams = nil): boolean; overload; function Write(Stream: TStream; FileType: TIOFileType; IOParams: TIOParams = nil): boolean; overload;
Description
Writes the image to a blob field, file or stream (to any format supported by the TImageEnIO class).
The Write(); overload sets the image at the current database position using the properties of DataSource, ImageBlobField and/or FilenameField..
If saving to a blob or stream you must specify the FileType
You can optionally specify an TIOParams object containing the I/O parameters of the file (see also ParamsEnabled).
Returns true on success.
// Rotate the current image in the database (assumes you have set DataSource and ImageBlobField) fDBBitmap.Rotate( -90 ); MyTable.Edit; MyTableName.AsString := 'Rotated 90'; fDBBitmap.Write( MyTableImageBlob, ioJPEG ); MyTable.Post;
// Append an image to the database (maintaining its meta-data) MyBMP := TIEDBBitmap.Create(); MyBMP.ParamsEnabled := True; // So bitmap stores the params/meta-data MyBMP.Read( 'D:\MyBlobImage.jpeg' ); MyTable.Append; MyTableName.AsString := 'My Cool Image'; MyBmp.Write( MyTableImageBlob, ioJPEG ); MyTable.Post; MyBmp.Free;
// Append a thumbnail to the database MyBMP := TIEDBBitmap.Create(); MyBMP.Read( 'D:\MyBlobImage.jpeg' ); IEBmp.Resample (100, 100, rfFastLinear, True); // Convert to thumbnail MyTable.Append; MyTableName.AsString := 'My Thumbnail'; MyBmp.Write( MyTableImageBlob, ioJPEG ); MyTable.Post; MyBmp.Free;