procedure TFormFoto.ZeigeFoto(
DB:
String; ID: TiBtrvID);
var
lpTblGraph: TpBtrvDBTableData;
lbmpImage: TBitmap;
lmstImage: Tmemorystream;
laImage : TaByte;
lgrpImage: TGraphic;
ljpgImage: TJPEGImage ;
lpicImage:TPictureTyp ;
Buffer : Word;
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
{$IFDEF TITAN}
laImage := GetBlob(lpTblGraph);
{$ENDIF} // DEF TITAN
lmstImage.Clear;
lmstImage.
Write(laImage[0], Length(laImage));
lmstImage.Position := 0;
lmstImage.
Read(Buffer,4);
Buffer := Swap(Buffer);
//lpicImage:= PictureTyp_pruefen(lmstImage);
case Buffer
of
$FFD8:
begin
ljpgImage.LoadFromStream(lmstImage);
lbmpImage := TBitmap.Create;
try
lbmpImage.Assign(ljpgImage);
lgrpImage.Free;
lgrpImage := lbmpImage;
Image1.picture.Graphic := (lgrpImage);
finally
lbmpImage.Free;
end;
end;
$424D:
begin
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;
$8950:
begin
Showmessage('
ÄÄ');
end;
end;
FormFoto.Caption :=
DB + '
-' + IntToStr(ID);
FotoResize;
end
else
begin
lgrpImage :=
nil;
end;
finally
// lbmpImage.Free;
lmstImage.Free;
ljpgImage.Free;
end;
end;