Linux Picture.LoadFromStreamWithFileExt Crashes on .jpg From DB Blob Field lazarus / 16-Databases ---------------------------------------------------------------------- mrmikehicks · 2010-04-04 22:14 Hello, I am attempting to port a lazarus project from win to linux. Have worked out all the bugs except one. Here are the stats: sqlite3 database with blob fields used to store jpg images (works on windows) using sqlite3dataset no problem accessing all records. When program loads, I have pictures already in the database. If the selected record has images stored in blob field, then I load the database blob field into a TStream var  (works) Then I try to load the pictuture into a TImage component with: TImage.Picture.LoadFromStreamWithFileExt and it throws an exception: Project ..;. raised exception class 'Exception' with message: ###(gdb unparsed remainders:s 0xffffffffffffffec out of bounds>)### Code: the var ctrl is for the case statement to select which pic (TImage) to load. //To load from BLOB: procedure TForm1.load_blob_pic(fbyname:string; ctrl:integer);   var blob: TStream;   var image_ctrl: integer; begin   image_ctrl := ctrl;   blob := sqlite3dataset1.CreateBlobStream(sqlite3dataset1.FieldByName(fbyname), bmRead);   try     blob.Seek(0, soFromBeginning);     try     case image_ctrl of       1:begin           image_pic1.Picture.LoadFromStreamWithFileExt(blob, '.jpg');           image_pic1.Update;       end; ...       8:begin           image_pic8.Picture.LoadFromStreamWithFileExt(blob, '.jpg');           image_pic8.Update;       end;     end;     finally       //Free;     end;   finally     blob.Free;     image_pic8.Update;     image_pic7.Update;     image_pic6.Update;     image_pic5.Update;     image_pic4.Update;     image_pic3.Update;     image_pic2.Update;     image_pic1.Update;   end; end; All of this works well in win32. Is there something I need to do for .jpg images on linux??      Thanks for any and all help      Mike ---------------------------------------------------------------------- mrmikehicks · 2010-04-05 00:46 Same thing happens on win32, if I use sqlite3dataset or Tsqlite3connection. Only sqlite3 that seems to support blob images is zeos, and zeos is screwed up on linux (64bit ubuntu) platform, so what to do??? ---------------------------------------------------------------------- mrmikehicks · 2010-04-05 00:48 Linux doesn't give you any information on the error, but win32 says it's a jpg error, when I try to load the picture into the timage. ---------------------------------------------------------------------- fredycc · 2010-04-05 02:03 Hi, I use this piece of code to display a picture from a firebird database, check the first sentence before assign the picture, in this case a have used a record to storage the picture before assign this is because i can't use the blob directly to lazreport. I have tested it for windows, opensuse & leopard. Image1.Picture.Graphic:= TJpegImage.Create; ImgArray.BLOB[PosArray].Seek(0,0); Image1.Picture.Graphic.LoadFromStream(ImgArray.BLOB[PosArray]); ---------------------------------------------------------------------- mrmikehicks · 2010-04-05 07:33 Thanks, but just tried that code too. I think the prob is with sqlite3dataset. I have a complete example program, if anybody is interested in testing it to find out why it gets jpg error. This forum will only allow 28k of file upload, so I have it set up on my local ftp server. People will probably hack me to death, but I think it is a secure enough ftp server. The login is 'forum' pw 'lazarus' and the IP that might work is 71.12.168.199 (I have port forwarding for ftp to my laptop with the ftp server running there. As always, thanks in advance.      Mike ---------------------------------------------------------------------- José Mejuto · 2010-04-05 13:51 Quote from: mrmikehicks on April 05, 2010, 09:33:25 amThanks, but just tried that code too. I think the prob is with sqlite3dataset. I have a complete example program, if anybody is interested in testing it to find out why it gets jpg error. This forum will only allow 28k of file upload, so I have it set up on my local ftp server. People will probably hack me to death, but I think it is a secure enough ftp server. The login is 'forum' pw 'lazarus' and the IP that might work is 71.12.168.199 (I have port forwarding for ftp to my laptop with the ftp server running there. As always, thanks in advance.      Mike Hello, Instead LoadFromStreamWithExt just write the "stream" to a file and compare with the original jpg or the jpg that should be there.