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
 ImageEnMView Save Single Image to Database OnAdded
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

DelphiLover

USA
7 Posts

Posted - Mar 30 2018 :  19:58:50  Show Profile  Reply
Hello,
I use ImageEnMView and ImageEnDBView
I want to save every single image to new database record when loading mutiple images
I tried OnImageLoaded and OnImageAdded events but it didn't work
Is there any way to do this without have to wait loading all images finished and loop thru them?
Thank you

xequte

38189 Posts

Posted - Mar 30 2018 :  20:47:52  Show Profile  Reply
Hi

Rather than using an ImageEnMView, which will try to load all images, why not use a TIEBitmap (or TImageEnView). Iterate through the frames in turn (by settings:

cnt := IEGetFileFramesCount(...);
for idx := 0 to cnt - 1 do 
begin
  BMP.ParamsEnabled := True;
  BMP.Params.Index := idx;
  BMP.Read(...);
  Assign to DB...
end;




Nigel
Xequte Software
www.imageen.com
Go to Top of Page

DelphiLover

USA
7 Posts

Posted - Mar 31 2018 :  06:12:24  Show Profile  Reply
Hi, Thank you for your answer.

I thought about this, but it will take more time especially i'm resizing all images to 200KB before save them to database so it will be 3 stages

1- Adding images from Scanner or Multiple files
2- Iterate thru images to resize them
3- Iterate thru images to save them to database

also if user update an image I will have to Iterate thru all images again to resize and save to database

It will be much easier, and cleaner way if we can Resize and save to database every single image immediately when it is added to ImageEnMView so we don't have to Iterate thru images at all
Go to Top of Page

xequte

38189 Posts

Posted - Apr 02 2018 :  01:30:15  Show Profile  Reply
OK, I'm not fully following your method. Whether you resize them before saving to the database, should not matter.

Some thoughts:

- Don't use ImageEnDBView, it is outdated. Use TIEDBBitmap (e.g. connected to a TImageEnView) or TIEDBMultiBitmap (connected to a TImageEnMView).
- ImageEnMView will load images on demand if you use an OnDemand method, such as: https://www.imageen.com/help/TImageEnMView.LoadFromFileOnDemand.html
- OnImageAdded does not apply when loading. OnImageLoaded is called as each image is loaded
- If a TImageEnMView is loading images on demand, you can force loading of an image by accessing, e.g. using GetTIEBitmap.

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