Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Slideshowpro php script x immagini

    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>';


    ?>

  2. #2
    output che lo script restituisce è questo

    <?xml version="1.0" encoding="utf-8" ?>
    - <gallery>
    - <album title="F1 TEST FIA MONZA - 2005" description="Test Fia F1 di preparazione una settimana prima del weekend di gara sul circuito Brianzolo (Foto di Ranzato Massimo)" lgPath="http://localhost/test/gallery/motorsportarchive/F1 TEST FIA MONZA - 2005/lg/" tnPath="http://localhost/test/gallery/motorsportarchive/F1 TEST FIA MONZA - 2005/tn/" tn="http://localhost/test/gallery/motorsportarchive/F1 TEST FIA MONZA - 2005/tn1/IMG_0037.jpg" startHere="">
    [img]IMG_0004.jpg[/img]
    [img]IMG_0006.jpg[/img]
    [img]IMG_0007.jpg[/img]
    [img]IMG_0010.jpg[/img]
    [img]IMG_0012.jpg[/img]
    [img]IMG_0013.jpg[/img]
    [img]IMG_0019.jpg[/img]
    [img]IMG_0021.jpg[/img]
    [img]IMG_0024.jpg[/img]
    [img]IMG_0026.jpg[/img]
    [img]IMG_0027.jpg[/img]
    [img]IMG_0033.jpg[/img]
    [img]IMG_0037.jpg[/img]
    [img]IMG_0042.jpg[/img]
    [img]IMG_0043.jpg[/img]
    [img]IMG_0043A.jpg[/img]
    [img]IMG_0045.jpg[/img]
    [img]IMG_0047.jpg[/img]
    [img]IMG_0061.jpg[/img]
    [img]IMG_0062.jpg[/img]
    [img]IMG_0068.jpg[/img]
    [img]IMG_0070.jpg[/img]
    [img]IMG_0077.jpg[/img]
    [img]IMG_0082.jpg[/img]
    [img]IMG_0092.jpg[/img]
    [img]IMG_0094.jpg[/img]
    [img]IMG_0095.jpg[/img]
    [img]IMG_0097.jpg[/img]
    [img]IMG_0103.jpg[/img]
    [img]IMG_0114.jpg[/img]
    [img]IMG_0115.jpg[/img]
    [img]IMG_0119.jpg[/img]
    [img]IMG_0121.jpg[/img]
    [img]IMG_0129.jpg[/img]
    </album>
    </gallery>


    legge correttamente la prima cartella e poi si ferma li...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.