ciao a tutti, se qualcuno può aiutarmi ho il seguente problema sto cercando di riadattare uno script in php che ho trovato per creare la configurazione xml che la galleria chiede x leggere dove sono le immagini, premetto che nn ne capisco moltissimo di php, ma sono riuscito ad aggiungere del codice dove mi servira il bello viene ora, lo script legge da una cartella madre delle sotto cartelle dove sono le mie immagini cosi strutturate
/cartella madre
/album1 (contenente)/lg /tn /tn1 /txt
/album2 (contenente)/lg /tn /tn1 /txt
/album3 (contenente)/lg /tn /tn1 /txt
/album4 (contenente)/lg /tn /tn1 /txt
ecc
alla fine lo script crea al suo interno l'impostazione in xml con i dati che servono a slideshowpro per la visualizzazione delle immagini,da quello che ho capito lavora tutto tramite array ma mi restituisce solo il contenuto della prima cartella correttamente ciò che vorrei io e che lo script restituisse anche le altre con i puntamenti (img src) ai files contenuti nelle cartelle /lg di ogni album, penso sia da strtturarlo con diverse array ma nn so come fare grazie in anticipo x l'help
lo script è questo :
<?php
/* -------------------------------------------------
Slideshowpro Example Directory Structure:
/
/gallery
/album (name of gallery)
/lg (folder with images)
/tn (folder with thumbnails of images)
/tn1 (folder with album thumbnails)
/txt (folder with txt file for album description)
------------------------------------------------- */
//
//Directory where all album folders are located
$albums_dir = '/test/gallery/motorsportarchive';
//
//Get directories for photo albums
$d = dir($_SERVER['DOCUMENT_ROOT'].$albums_dir);
while (false !== ($entry = $d->read())) {
if(is_dir($d->path.'/'.$entry) && $entry != '.' && $entry != '..') {
$albums[] = $entry;
}
}
$d->close();
//
//
//Send content type as text/xml so the browser knows it's an xml file
header('Content-type: text/xml');
//
//Generate xml data
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<gallery>';
for($i = 0; $i < sizeof($albums); $i++) {
$album_title = ucwords(eregi_replace('_',' ',$albums[$i])); //Remove underscores and capitalize the words in the album directory
//
// Get album thumb string
$album_thumb_dir = $_SERVER['DOCUMENT_ROOT'].$albums_dir.'/'.$albums[$i].'/tn1';
$dh = opendir($album_thumb_dir);
while (false !== ($filename = readdir($dh))) {
if (eregi("jpg",$filename)) {
$album_thumb[] = $filename;
}
};
//
// Get album description string from dir /txt
$album_desc_dir = $_SERVER['DOCUMENT_ROOT'].$albums_dir.'/'.$albums[$i].'/txt';
$dh1 = opendir($album_desc_dir);
while (false !== ($filename = readdir($dh1))) {
if (eregi("txt",$filename)) {
$album_desc = $filename;
}
};
$final_path = $album_desc_dir.'/'.$album_desc;
$open_data = fopen($final_path,'r');
$read_data = fread($open_data,filesize($final_path));
fclose($open_data);
//
// Parse xml mode for slideshow config
echo ' <album title="'.$album_title.'" description="'.$read_data.'"
lgPath="http://'.$_SERVER['HTTP_HOST'].$albums_dir.'/'.$albums[$i].'/lg/"
tnPath="http://'.$_SERVER['HTTP_HOST'].$albums_dir.'/'.$albums[$i].'/tn/"
tn="http://'.$_SERVER['HTTP_HOST'].$albums_dir.'/'.$albums[$i].'/tn1/'.$album_thumb[$i].'"
startHere="">';
//
// Load all photos for this album into an array, then print them out
$album_photos_dir = $_SERVER['DOCUMENT_ROOT'].$albums_dir.'/'.$albums[$i].'/lg';
$dh = opendir($album_photos_dir);
while (false !== ($filename = readdir($dh))) {
if (eregi("jpg",$filename)) {
$album_photos[] = $filename;
}
}
for($i = 0; $i < sizeof($album_photos); $i++)
{
echo ' [img]'.$album_photos[$i].'[/img]';
}
echo ' </album>';
}
echo '</gallery>';
?>