|
Posted by LAshooter on 07/21/05 05:58
I'm trying to create a "template" script that will allow me to look at a dir
provided via POST, getting a list of the filenames in that dir, and then
running a slideshow using a working javascript function.
***************************************************
This is the array section in the working script:
var slideshow_width='300px' //SET IMAGE WIDTH
var slideshow_height='200px' //SET IMAGE HEIGHT
var pause=2000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="/graphics/shootout/200/_aaaaaaa.jpg"
fadeimages[1]="/graphics/shootout/200/shootout01.jpg"
fadeimages[2]="/graphics/shootout/200/shootout02.jpg"
fadeimages[3]="/graphics/shootout/200/shootout03.jpg"
etc...
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
etc...
****************************************************
This is what I've tried thus far, but generates only the first echo
"Resource id #1":
extract($_POST); //provides the directory to browse for images
$dir = opendir("graphics/$path/images");
echo "$dir"; // see if we have the right directory
$files = readdir($dir);
$fadeimages[] = array($files);
echo "<script language=\"JavaScript1.2\" type=\"text/javascript\">
var slideshow_width='360px'
var slideshow_height='360px'
var pause=3000
var fadeimages=new Array()";
echo "$fadeimages=\"$dir/$file\"\n";
echo "var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
Am I missing something obvious here trying to get the filenames to fill the
array??
Thanks,
Wm
Navigation:
[Reply to this message]
|