Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Run script when done uploading

03 Sep 2011, 05:09

Thanks, works good.
I don't know why before didn't works, maybe I put the code in wrong place...

BTW.
Imagevue use data caching, so sometimes "Last added" module stays not updated until browser cache is not cleared. Then is good to add "?nocache="+getTimer()" to flash module code:
Code
Your_XML_Loader.load("xml_file.xml?nocache="+getTimer());
Then module will always load a fresh copy of xml file :wink: .
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Run script when done uploading

05 Sep 2011, 02:25

I would add current date or date+hours so it gets refreshed daily or hourly instead of being refreshed every time.
firedev.com
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Run script when done uploading

05 Sep 2011, 13:20

Of course, for "new added" module is not necesary to load all the time a fresh xml copy. Thanks for suggestion :wink:
I just use this code for all my modules and for example in comments system is better to get it fresh all the time.
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Run script when done uploading

07 Sep 2011, 12:46

I wish to know one more thing. :oops:

I would like to run some script when an image is deleted, so I found function called "deleteFilesAction()" In the file "IndexController.php".

I put my stuff right after:
Code
if ($file && $file->delete()) {
	$deleted++;
My stuff is:
Code
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->load("new_files.xml");
$xpath = new DOMXpath($dom);
$items = $xpath->query("/images/image[@image_name='$filename']");
foreach ($items as $item)
{
	$item->parentNode->removeChild($item);
}
$dom->save("new_files.xml");
Everything seems to be ok, but there is something more to edit in the code, because my code works only for "multi delete" in admin panel.
I mean, if I press "red cross" button on image thumbnail then my stuff not works. when I mark the thumbnail (green bird), and press "Delete" button on the bar above thumbnails, then I get my stuff to works...
What do you think? I'll be glad if you again waste few minutes of your time for answer my question :wink: .
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Run script when done uploading

08 Sep 2011, 01:28

You need to add your code in the FileController, somewhere around this area:
Code
			
$result = $file->delete();
ivMessenger::add(ivMessenger::NOTICE, ($result ? 'File succesfully deleted' : "File wasn't deleted"));		
firedev.com
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Run script when done uploading

08 Sep 2011, 09:25

Thanks a lot. I'll check this out.