Yes. I can see now, that
$imageName is not only name of image, but also "dot" + extension.
Already done code that store the last 20(can be changed) images in the xml file. The rest job is done by the flash module
If somebody will need, there is the code I use (I know it can be simplified , but I'm not so good PHP coder):
$simplepath = ROOT_DIR . $this->path;
$today = date("m.d.y");
$thumbPrefix = "tn_";
$swfAddressPrefix = "#";
$imageUrl = "$swfAddressPrefix$simplepath$imageName";
$thumbnailUrl = "$simplepath$thumbPrefix$imageName";
function loadXmlFile() {
$domtree = new DOMDocument('1.0', 'UTF-8');
$domtree->load("new_files.xml");
$rootElement = $domtree->documentElement;
$newImage = $domtree->createElement("image");
$newImage = $rootElement->appendChild($newImage);
$fileDetails = $domtree->createAttribute("date");
$newImage->appendChild($fileDetails);
$imageDetails = $domtree->createTextNode($today);
$fileDetails->appendChild($imageDetails);
$thumb = $domtree->createAttribute("thumb");
$newImage->appendChild($thumb);
$thumbValue = $domtree->createTextNode($thumbnailUrl);
$thumb->appendChild($thumbValue);
$imagelink = $domtree->createAttribute("image_link");
$newImage->appendChild($imagelink);
$imageValue = $domtree->createTextNode($fullpath);
$imagelink->appendChild($imageValue);
$imagename = $domtree->createAttribute("image_name");
$newImage->appendChild($imagename);
$imagenameValue = $domtree->createTextNode($imageName);
$imagename->appendChild($imagenameValue);
$itemsId = $domtree->getElementsByTagName('image');
$id = 1;
foreach ($itemsId as $itemId) {
$itemId->setAttributeNode(new DOMAttr('id', $id));
++$id;
}
$domtree->save("new_files.xml");
}
//Let's check if the current folder is "_altimage". If so, uploaded image data will not be stored in xml file.
$findme = '_altimage';
$pos = strpos($simplepath, $findme);
if ($pos === false) {
$deleteElementId = new DOMDocument('1.0', 'UTF-8');
$deleteElementId->load("new_files.xml");
$numberOfNodes = $deleteElementId->getElementsByTagName('image')->length;
//We want 20 images as "Newest" . So, If xml file already include 20 images, script will delete oldest image data and save newest one.
if ($numberOfNodes == 20) {
$xpath = new DOMXpath($deleteElementId);
$items = $xpath->query('/images/image[@id="1"]');
foreach ($items as $item) {
$item->parentNode->removeChild($item);
}
$deleteElementId->save("new_files.xml");
loadXmlFile();
} else {
loadXmlFile();
}
} else {
echo "The string '$findme' was found";
}
And the example data in xml file:
<?xml version="1.0" encoding="UTF-8"?>
<images>
<image details="08.28.11" thumbnail="/content/gallery/pics/tn_PIC_0001.jpg" url="#/content/gallery/pics/PIC_0001.jpg" image_name="PIC_0001.jpg" id="1"/>
<image details="08.28.11" thumbnail="/content/gallery/pics/tn_PIC_0002.jpg" url="#/content/gallery/pics/PIC_0002.jpg" image_name="PIC_0002.jpg" id="2"/>
<image details="08.28.11" thumbnail="/content/gallery/pics/tn_PIC_0003.jpg" url="#/content/gallery/pics/PIC_0003.jpg" image_name="PIC_0003.jpg" id="3"/>
...
</images>
The images are sorted by the "id" tag. So, first image will always be oldest. For reverse images order (newest->oldest), remember put the folowing code in your flash module:
var childItems=this.firstChild.childNodes;
childItems.reverse();
One thing I can't figure out - how to disable operations on xml file when folder is hidden or protected by password. I've trying this, but doesn't works

:
$folder = ivMapperFactory::getMapper('folder')->find(ROOT_DIR . $this->path);
if ($folder->hidden == 'false') {
my_action...
}else{
echo "Folder is Hidden";
}