Subject | Re: tib_image code example? |
---|---|
Author | |
Post date | 2015-10-06T03:00:12Z |
Thanks Rob and Massimo.
It did not occur to me to use paramByName(...).loadFromFile(..). To load the DB from a file I used
************
// get picFile,use picID to locate the record
picId := getGenValue('GEN_PICS');
with dsqlRW do
begin
sql.text := 'insert into PICS (pic_id,pic,comment,pic_type_id, target_id) values ('+#13+
quotedStr(inttostr(picID))+',:anImage,'+
'''No comment'', ''300'',+' +
quotedStr(inttostr(mtrID))+')';
ParamByName('anImage').LoadFromFile(picFile);
prepare;
execute;
end;
************
In my program users can select an image file using TOpenPictureDialog which supports more image formats than IBO TIB_IMAGE which supports only bmp, ico and Metafile. (I checked the first two and they load in a TIB_IMAGE control)
So I guess I'll use another control here not the TIB_IMAGE.
Perhaps Delphi's TImage and the dataSOurce's OnChange event to load the blob image into a TBLOBStream then into the TImage.Picture?