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
 FillFromDirectory works MIO.LoadFromFiles fails ..

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
Greg Lumley Posted - May 30 2012 : 14:13:41
First of all please bear with me, I'm very very new to Delphi!

I'm building an app whereby users can select images, it's all going well but now I want them to be able to filter only the selected images from the database, so building a string I'm using the ImageEnMView.MIO.LoadFromFiles method which does load the files successfully to the thumbgrid but now, ImageEnMView1.ImageFileName[0] no longer returns the filename which I'm using as a unique key in an sqlite db... of course all this causes the SQL statement to fail... like I said please bear with me I'm still figuring this all out...


//ImageEnMView1.FillFromDirectory(DirectoryListBox1.Directory); //All working perfectly with this line.
 ImageEnMView1.MIO.LoadFromFiles('dacl_f_00053.jpg|dacl_f_00057.jpg|dacl_f_00058.jpg|dacl_f_00059.jpg');//No longer returns the file name with this line...


Thank you for your assistance ;-)


Greg.
5   L A T E S T    R E P L I E S    (Newest First)
Greg Lumley Posted - May 31 2012 : 08:44:26
Fabrizio, I just re-read your original post... it was a case of paying attention on my part, it's very very clear! I feel like a bit of an idiot here... thanks for helping me anyway!

G

Greg.
Greg Lumley Posted - May 31 2012 : 08:41:32
Hi Fabrizio, I'm not going to lie... I'm hacking here! I'm from a self taught PHP background, I stopped 7 years ago and I'm now a professional photographer (I'm far better at that!) when I coded for a living I tried to teach myself good habits not always managing... you might as well have spoken Japanese there for a moment.. it went over my head ;-)

Thank you for code it works perfectly and I'll probably be able to convert that Japanese to English as a result!

Your help is much appreciated!

Greg.

Greg.
fab Posted - May 31 2012 : 02:04:13
...
ImageEnMView1.MIO.LoadFromFiles('dacl_f_00058.jpg|dacl_f_00059.jpg');//A test string before dynamically generating from db.
  ImageEnMView1.SelectedImage := 0;
  ShowMessage(ImageEnMView1.ImageFileName[0]);// <-- it's now empty, "loadfromdirectory" autopopulates it but not LoadFromFile


yes, but this is exactly what I explained you. LoadFromFile doesn't populate ImageFileName[]!
If you have an array of filenames and you want to load them without LoadFromFiles, just write:

ImageEnMView1.Clear();
ImageEnMView1.ImageFileName[ ImageEnMView1.AppendImage() ] := 'dacl_f_00058.jpg';
ImageEnMView1.ImageFileName[ ImageEnMView1.AppendImage() ] := 'dacl_f_00059.jpg';
etc...
Greg Lumley Posted - May 31 2012 : 01:03:36
Hi Fabrizio, thank you for your answer... but I'm still hazy.

Perhaps if I show you my code (modified from the EnImageExamples)



ImageEnMView1.Clear;
ImageEnMView1.FillFromDirectory(DirectoryListBox1.Directory);

  ImageEnMView1.SelectedImage := 0;
  ShowMessage(ImageEnMView1.ImageFileName[0]);//This displays the file name 
  ImageEnView1.io.LoadFromFile(ImageEnMView1.ImageFileName[0]);

  //Load the main image variable as well as the label
  pub_currentimagename :=   ExtractFileName(ImageEnMview1.ImageFileName[0]) ;
  self.lbl_currentimage.Caption :=  pub_currentImageName;



Further on in the code if a user selects an image its entered as a new row in the sqlite db...

My next step is to allow the user to see what he/she has selected so far so instead of loading the directory I'd like to load only the selection from the database as a string...

Below is what I tried when it failed...


  ImageEnMView1.Clear;

  ImageEnMView1.MIO.LoadFromFiles('dacl_f_00058.jpg|dacl_f_00059.jpg');//A test string before dynamically generating from db.
  ImageEnMView1.SelectedImage := 0;
  ShowMessage(ImageEnMView1.ImageFileName[0]);// <-- it's now empty, "loadfromdirectory" autopopulates it but not LoadFromFile
  ImageEnView1.io.LoadFromFile(ImageEnMView1.ImageFileName[0]);
  pub_currentimagename :=   ExtractFileName(ImageEnMview1.ImageFileName[0]) ;
  self.lbl_currentimage.Caption :=  pub_currentImageName;


What would you do to fix it?

Thank you!

Greg.

Greg.
fab Posted - May 30 2012 : 22:57:44
They are two very different ways to present images in TImageEnMView.
Setting ImageFileName[] tells TImageEnMView to load the image only when it is actually necessary. It is not an informative tag.
For example FillFromDirectory just fills ImageFileName[] with the file names to load (when necessary).
Instead TImageEnMView.MIO.LoadFromFile (and other TImageEnMView.MIO... methods ) actually loads one o more images immediately. It doesn't populate ImageFileName[], because images are loaded, even they aren't displayed.