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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Saving and loading Params to stream

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Patrick Quinn Posted - Aug 19 2017 : 09:37:19
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 20 2017 : 21:59:37
Nice :-)

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Patrick Quinn Posted - Aug 20 2017 : 19:01:31
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).






xequte Posted - Aug 19 2017 : 21:45:36
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