Forum > Databases
[SOLVED] Read Picture from Postgresql Database Unknown Picture Format [blob]
(1/1)
heejit:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- Working : astream : TStream astream := m_qry.CreateBlobStream(m_qry.FieldByName('file_data'), bmRead); self.imgWidget.Picture.LoadFromStream(astream); Not Working : Unknown Picture Format astream : TMemoryStream TBlobField(self.m_qry.FieldByName('file_data')).SaveToStream(astream); self.imgWidget.Picture.LoadFromStream(astream);
In documentation also it suggested to use TBlobField :
https://www.freepascal.org/docs-html/fcl/db/tdataset.createblobstream.html
Then why there is format Error?
Development Env:
Lazarus : 2.0
Feepascal : 3.0.4
SVN Rev : 60350M
OS : Linux 64bit Ubuntu 16.04
heejit:
Solved
We need to move the position of stream to beginning
astream.Position:=0;
Navigation
[0] Message Index