1

I've searched around but I can't find anything suitable for me. I found this, but it doesn't fit what I need.

I have a browse button with a .jpg filter, but I don't have a clue how to save the image to a blob field, then display onto a TImage.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
frozenade
  • 179
  • 1
  • 11
  • possible duplicate of [How to pull jpg from a Blob Field in Delphi and display in a TImage?](http://stackoverflow.com/questions/3987917/how-to-pull-jpg-from-a-blob-field-in-delphi-and-display-in-a-timage) – Marcus Adams Aug 15 '12 at 16:44
  • Use the appropriate BLOB stream for your DB and call SaveToStream on the jpeg image. I guess. – David Heffernan Aug 15 '12 at 17:17
  • @Marcus Adams, possibly yes, but I can't find the method to save it into field. – frozenade Aug 16 '12 at 08:40
  • if the field has SaveToStream method - how do you think, does the field also have LoadFromStream method ? if the TPicture has LoadToStream method - how do you think, does it also have SaveToStream method ? *And TBlobStream would probably be more shortcuting approach.* – Arioch 'The Aug 16 '12 at 09:06

1 Answers1

0

The following code shows how I save a picture into a blob field. qEditClass6Question is the field 'question' of the query qEditClass6. Once the picture is loaded into the blob field, the current tuple can be posted to the database.

Procedure TEditClassSix.LoadPic;
var
 j: TJPEGImage;

begin
 j:= TJPEGImage.Create;
 j.Assign (qEditClass6Question);
 image1.picture.assign (j);
end;
No'am Newman
  • 6,395
  • 5
  • 38
  • 50