Helmut Hort Posted June 19, 2011 Share Posted June 19, 2011 Hi Farshad, do you have a code example how we can load a picture into a firebird-databse blobfield at runtime. UniDBImage doesn't seem to work. Best regards Helmut Link to comment Share on other sites More sharing options...
zilav Posted June 19, 2011 Share Posted June 19, 2011 I think you first need to get your image in TStream with TUniFileUpload component, it has Completed event which provides a stream with uploaded file (your image) Completed(Sender: TObject; AStream: TFileStream); And then load it in the blob image field http://edn.embarcadero.com/article/27462 procedure TMainForm.ImageFileCompleted(Sender: TObject; AStream: TFileStream); var BlobField: TField; BS: TStream; begin with Query1 do begin Insert; BlobField := FieldByName('picturefield'); BS := CreateBlobStream(BlobField,bmWrite); AStream.SavetoStream(BS); Post; end; end; Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted June 19, 2011 Administrators Share Posted June 19, 2011 -OR- procedure TMainForm.ImageFileCompleted(Sender: TObject; AStream: TFileStream); begin with Query1 do begin Append; TBlobField(FieldByName('picturefield')).LoadFromStream(AStream); Post; end; end; It may be different for Firebird but general rule is to save image stream into blob stream. Link to comment Share on other sites More sharing options...
memoferprof Posted March 7, 2013 Share Posted March 7, 2013 Can you show me, please, what is the content of Query1.SQLthis on your example ////////////////////////////////////////////////////////////// procedure TMainForm.ImageFileCompleted(Sender: TObject; AStream: TFileStream);beginwith Query1 dobeginAppend;TBlobField(FieldByName('picturefield')).LoadFromStream(AStream);Post;end; end; ///////////////////////////////////////////////////////////// I am trying to Insert one Image on my MySQL the field is type BLOB, but I dont know how can do it, please help me. HOw you use the Query1? Link to comment Share on other sites More sharing options...
patmap Posted March 7, 2013 Share Posted March 7, 2013 Hi, See Full article with sample code: storing-images-in-database-mysql-and-ms-access-example regards Link to comment Share on other sites More sharing options...
rencarnacion Posted March 17, 2013 Share Posted March 17, 2013 What kind of image I can save in a SQL DataBase because when I try to Use Jpg I got an error, BitMap is Not Valid. How Could I Save Jpg in MS SQL server Link to comment Share on other sites More sharing options...
patmap Posted March 18, 2013 Share Posted March 18, 2013 Hi, Put Vcl.Imaging.jpeg in uses list. Regards Link to comment Share on other sites More sharing options...
rencarnacion Posted March 19, 2013 Share Posted March 19, 2013 It only Work with Delphi XE. Im using Delphi 2010 Thanks Ronny Encarnación Link to comment Share on other sites More sharing options...
Ronak Posted March 20, 2013 Share Posted March 20, 2013 http://forums.unigui.com/index.php?/topic/2225-save-image/ Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now