function GetGraphicClass( cClass: String ): TGraphicClass; begin if UpperCase(cClass) = 'TJPEGIMAGE' then Result := TJPEGImage else if UpperCase(cClass) = 'TGIFIMAGE' then Result := TGIFImage else if UpperCase(cClass) = 'TBITMAP' then Result := TBitmap else if UpperCase(cClass) = 'TICON' then Result := TIcon else if UpperCase(cClass) = 'TMETAFILE' then Result := TMetaFile else Result := TBitMap; end;
Comments
i need your help urgently.
thanks...
"Chris Ueberall [TeamDM]" escribi? en el mensaje
I answered the prior thread!
but...
it's appears error....
i thinks thats the problem is to saving GIF in blob file to be loaded
correctly to TGifImage component....
How is correct form...
To saving GIF in a blob, im using.....
// Image1: TImage; -- > it's a form image component
procedure SAVE;
var
ofs: TStream;
begin
TABLE.Append;
ofs := TMemoryStream.Create;
FotoPrd.Picture.Graphic.SaveToStream(ofs);
ofs.position := 0;
TABLEFieldImage.LoadFromStream(ofs);
TABLEFieldImageType.AsString :=
Image1.Picture.Graphic.ClassName;
TABLE.Post;
end;
I'm use this form...
procedure TForm1.LoadImage;
var
ofs: TStream;
Grclass: TGraphicClass;
Newgr, NewGrIcon: TGraphic;
begin
ofs := TMemoryStream.Create;
TABLEFieldImage.SaveToStream( ofs );
Grclass := GetGraphicClass( TABLEFieldImageType.AsString );
// it's result TGifImage class
NewGr := Grclass.Create;
ofs.Position := 0;
NewGr.LoadFromStream( ofs );
Image1.Picture.Graphic := Newgr;
end;
function GetGraphicClass( cClass: String ): TGraphicClass;
begin
if UpperCase(cClass) = 'TJPEGIMAGE' then
Result := TJPEGImage
else
if UpperCase(cClass) = 'TGIFIMAGE' then
Result := TGIFImage
else
if UpperCase(cClass) = 'TBITMAP' then
Result := TBitmap
else
if UpperCase(cClass) = 'TICON' then
Result := TIcon
else
if UpperCase(cClass) = 'TMETAFILE' then
Result := TMetaFile
else
Result := TBitMap;
end;
Nice, you got errors, but why don't ypou pubish them here?
try to load a GIF image from file into the BLOB field, what happens then?
regards,
Chris Ueberall;