Helmut Hort Posted June 19, 2011 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 Quote
zilav Posted June 19, 2011 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; Quote
Administrators Farshad Mohajeri Posted June 19, 2011 Administrators 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. Quote
memoferprof Posted March 7, 2013 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? Quote
patmap Posted March 7, 2013 Posted March 7, 2013 Hi, See Full article with sample code: storing-images-in-database-mysql-and-ms-access-example regards Quote
rencarnacion Posted March 17, 2013 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 Quote
patmap Posted March 18, 2013 Posted March 18, 2013 Hi, Put Vcl.Imaging.jpeg in uses list. Regards Quote
rencarnacion Posted March 19, 2013 Posted March 19, 2013 It only Work with Delphi XE. Im using Delphi 2010 Thanks Ronny Encarnación Quote
Ronak Posted March 20, 2013 Posted March 20, 2013 http://forums.unigui.com/index.php?/topic/2225-save-image/ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.