procedure TFormFoto.ZeigeFoto(
DB:
String; ID: TiBtrvID);
var
lpTblGraph: TpBtrvDBTableData;
lbmpImage: TBitmap;
lmstImage: Tmemorystream;
laImage : TaByte;
lgrpImage: TGraphic;
ljpgImage: TJPEGImage ;
begin
lbmpImage :=
nil;
lmstImage :=
nil;
ljpgImage :=nil;
try
//lbmpImage := TBitmap.Create;
lmstImage := Tmemorystream.Create;
ljpgImage := TJPEGImage.Create;
lpTblGraph := RelData('
GR');
PutSField('
GR', 1,
DB);
PutIdField('
GR', 2, ID);
if lGetRecord(lpTblGraph, 1)
then
begin
laImage := GetBlob(lpTblGraph);
lmstImage.Clear;
lmstImage.
Write(laImage[0], Length(laImage));
lmstImage.Position := 0;
ljpgImage.LoadFromStream(lmstImage);
lbmpImage := TBitmap.Create;
try
lbmpImage.Assign(ljpgImage);
lgrpImage.Free;
lgrpImage := lbmpImage;
Image1.picture.Graphic := (lbmpImage);
Except
lbmpImage.Transparent := True;
lbmpImage.LoadFromStream(lmstImage);
lbmpImage.TransparentColor := lbmpImage.Canvas.Pixels[0,
lbmpImage.Height - 1];
lbmpImage.ReleaseMaskHandle;
lgrpImage.Free;
lgrpImage := lbmpImage;
Image1.picture.Graphic := (lgrpImage);
end;
FormFoto.Caption :=
DB + '
-' + IntToStr(ID);
FotoResize;
end
else
begin
lgrpImage :=
nil;
end;
finally
lbmpImage.Free;
lmstImage.Free;
ljpgImage.Free;
end;
end;