I would like to store and retreave a TImage in / from a LONG RAW field
I use following code for storing the image :
stream := TMemoryStream.Create;
image_travail.Picture.Graphic.SaveToStream(stream);
GetMem(buffer, stream.Size);
stream.Seek(0, soFromBeginning);
size := stream.Read(buffer^, stream.Size);
...
query.SetLongVariable('p_image', buffer, size);
...
This seems to work fine... but I'm having trouble reading the field and storing the image into a TImage.
I tried to use GetLongField (btw, how can I know the size of the picture ?) and TGraphic.LoadFromStream, but I'm not getting anywhere.
Has anybody got a source code of a working example?
Thanks a lot
Attila Kr
I use following code for storing the image :
stream := TMemoryStream.Create;
image_travail.Picture.Graphic.SaveToStream(stream);
GetMem(buffer, stream.Size);
stream.Seek(0, soFromBeginning);
size := stream.Read(buffer^, stream.Size);
...
query.SetLongVariable('p_image', buffer, size);
...
This seems to work fine... but I'm having trouble reading the field and storing the image into a TImage.
I tried to use GetLongField (btw, how can I know the size of the picture ?) and TGraphic.LoadFromStream, but I'm not getting anywhere.
Has anybody got a source code of a working example?
Thanks a lot
Attila Kr