Windows-7, Lazarus 32 bit
SQLite3 database.
Hi everyone,
Still trying to show photo from Grid.
The app is OK so far, except when current grid field is at column named 'Pic' (which holds the photo) that is to show in Image1 box (TImage), I get the error :
DEBUGGER EXCEPTION NOTIFICATION:
class FPIMageException with message: Bitmap with unknown compression(8077443525)
and I have not been able to find out the problem.
The procedure runs when the cursor enters a grid field, and if the field datatype is Blob, then the field's image is to be shown in box Image1.
Could it be my code? Is there perhaps a known problem that I need to know about concerning the showing of images, that I am not properly addressing?
Would appreciate help.
Thanks.
//Am getting: DEBUGGER EXCEPTION NOTIFICATION:
//class FPIMageException with message: Bitmap with unknown compression(8077443525)
procedure TForm1.DBGrid1ColEnter(Sender: TObject);
var
BlobField: TField;
BS: TStream;
{L_FieldDataType is a TLabel;}
{'Pic' is the SQLITE3 column name with photograph with format .bmp}
{Image1 is component on Form1 type TImage}
BEGIN
L_FieldDataType.Caption:=Fieldtypenames[dbgrid1.SelectedField.DataType];
if L_FieldDataType.Caption = 'Blob' then
Begin
with SQLQuery1 do
begin
BlobField := FieldByName('Pic'); {'Pic' is name of column with photo}
BS := CreateBlobStream(BlobField,bmRead);
Image1.Picture.Graphic:= TBitmap.Create;
Image1.Picture.Graphic.LoadFromStream(BS);
BS.Free;
end;
END;
END;