1) Script Title: Ultimate Fade-In Slideshow ver. 2.4
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nslideshow.htm
3) Describe problem: I thought this might be something others would want... I wanted to have the script read the files from a directory and dynamically build the slideshow. This way all you have to do is add a new file (or delete a file) from the directory and it automatically updates into the web page. It uses a php call to get the files and echos them into the page before it is served to the client (I also use random ordering of the slides so it does not matter how the
the array is built). Just so you know, glob() will read the directory in alphabetical order. Here is the code:
Just change the name of the directory from "main_page_images" to the name of your directory and it should work (of course, in thisCode:var mygallery2=new fadeSlideShow({ wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow dimensions: [876, 313], //width/height of gallery in pixels. Should reflect dimensions of largest image imagearray: [ <?php // Build imagearray by reading files from main_page_images directory $x=0; $file=array(); foreach (glob("main_page_images/*.*") as $filename) { // populate the array by reading directory contents $file[$x++] = $filename; } $len = count($file) - 1; // gets correct ending array number - needs to be one less since array starts at zero for ($x = 0; $x <= $len - 1; $x++) { // echo all array elements except last one echo "[\"".$file[$x]."\", \"\" , \"\"],\n"; } echo "[\"".$file[$len]."\", \"\" , \"\"]\n"; // echo last array element witout trailing comma ?> ], displaymode: {type:'auto', pause:10000, cycles:0, wraparound:true, randomize:true}, persist: false, //remember last viewed slide and recall within same session? fadeduration: 1000, //transition duration (milliseconds) descreveal: "",
example the directory is a "relative" subdirectory off the directory were the web page exists. If yours is not, you will need to change it to it's absolute path).
I hope someone finds this useful![]()



Reply With Quote

Bookmarks