ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Saving and loading Params to stream
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Patrick Quinn

United Kingdom
81 Posts

Posted - Aug 19 2017 :  09:37:19  Show Profile  Reply
I am trying to find a way save the Params of an image in a TImageEnMView to a database table, then load these from the table to read the EXIF properties of that image. I am using the ABS database (similar to BDE).

I save using this code:
BlobStream := TABSBLOBStream(dmDatabase.TblImages.CreateBlobStream(TblImages.FieldByName('Params'), bmWrite));
try
  ImageEnMViewFolder.MIO.Params[idx].SaveToStream(BlobStream);
finally
  BlobStream.Free;
end;
If I then try and load the params using this:
BlobStream := TABSBLOBStream(tblImages.CreateBlobStream(tblImages.FieldByName('Params'), bmread));
try
  frmMain.ImageEnViewMain.IO.Params.LoadFromStream(Blobstream);
finally
  BlobStream.Free;
end;
I get this error:
 
Invalid TIOParams stream. You cannot use TIOParams.LoadFromStream or LoadFromFile to load parameters from image files.
I'm obviously going about this the wrong way. My question is, what is the best way to save an image file's Params, then load it again from a stream?

Patrick

ImageEn 7.0.0, Delphi 10.2, Windows 10

xequte

38196 Posts

Posted - Aug 19 2017 :  21:45:36  Show Profile  Reply
Hi Patrick

That error means that ImageEn is not seeing the correct header on the data it is reading from the blob.

Does the blob field contain content? Try resetting the Blobstream position to 0 before LoadFromStream (even though the code above applies that it is).

If that fails, save the blob stream to a file and email it to me.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Aug 20 2017 :  19:01:31  Show Profile  Reply
Thanks, Nigel.
I've now got it working. I'm not sure what I did to fix it but maybe putting
if not QueryImages.FieldByName('Params').IsNull then
  begin...

  end;
around the 'load from stream' code stopped the error from happening?

All now working fine now, database records show the image, place taken on a slippy map, EXIF data in a stringgrid and nearest street, town, area, country names etc (using geonames.org reverse geocoding APIs).






Go to Top of Page

xequte

38196 Posts

Posted - Aug 20 2017 :  21:59:37  Show Profile  Reply
Nice :-)

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: