procedure TFormFoto.ZeigeFoto(
DB:
String; ID: TiBtrvID);
var
lpTblGraph: TpBtrvDBTableData;
lbmpImage: TBitmap;
lmstImage: TMemoryStream;
laImage : TaByte;
lgrpImage: TGraphic;
ljpgImage: TJPEGImage;
lpicImage: TPictureTyp;
begin
lbmpImage :=
nil;
lmstImage :=
nil;
ljpgImage :=
nil;
try
lbmpImage := TBitmap.Create;
lmstImage := TMemoryStream.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;
lpicImage := PictureTyp_pruefen(lmstImage);
case lpicImage
of
pw_JPG:
begin
lmstImage.Clear;
lmstImage.
Write(laImage[0], Length(laImage));
lmstImage.Position := 0;
ljpgImage := TJPEGImage.Create;
ljpgImage.LoadFromStream(lmstImage);
try
lbmpImage.Assign(ljpgImage);
lgrpImage.Free;
lgrpImage := lbmpImage;
Image1.picture.Graphic := (lgrpImage);
finally
ljpgImage.Free;
end;
end;
pw_BMP:
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;
pw_None:
begin
Application.MessageBox('
ungultiges Foto', '
AIDA',MB_OK
or MB_ICONERROR);
end;
end;
FormFoto.Caption :=
DB + '
-' + IntToStr(ID);
FotoResize;
end
else begin
lgrpImage :=
nil;
end;
finally
lmstImage.Free;
lbmpImage.Free;
end;
end;