Thursday, 12 September 2013

Load JPEG image into a BlobField

Load JPEG image into a BlobField

I would like load JPEG image into a blob field, is it possible? I search a
lot but I don't find a clear answer.
I use this code:
var
BlobField : TBlobField;
Stream : TMemoryStream;
begin
BlobField := ClientDataSet1.FieldByName('image');
// Img is TImage and contain a JPEG image
Img.Picture.Graphic.SaveToStream(Stream);
Stream.Position := 0;
BlobField.LoadFromStream(Stream); // <-- Error: "Bitmap image is not
valid"
I have to use bitmap image?

No comments:

Post a Comment