Am trying to load a photo from a TImage to a blob field using a TMemoryStream as shown below but every time it saves a null value.
//The entity part
[Column('Photo', [TColumnProp.Lazy])]
FPhoto : TBlob;
//Loading the Image to the blob field
if Photo.Picture.Graphic <> Nil then
Begin
PhotoStream := TMemoryStream.Create;
Photo.Picture.Graphic.SaveToStream(PhotoStream);
MyUser.Photo.LoadFromStream(PhotoStream);
PhotoStream.Free;
End;
What does one need to do to get it working?
Have you tried
PhotoStream.Position := 0;
before the blob tries to load it from stream?
That did the trick, thanks man