Can anyone show me what modifications to make to this script:
http://www.dynamicdrive.com/dynamici...nslideshow.htm
So that it preloads ALL the images in a given directory before playing them in two windows.
Thanks in advance very much!
Nelson
Can anyone show me what modifications to make to this script:
http://www.dynamicdrive.com/dynamici...nslideshow.htm
So that it preloads ALL the images in a given directory before playing them in two windows.
Thanks in advance very much!
Nelson
Is there another script that will use PHP or something to fetch all the images in a given directory that I can combine with the ultimate fade in slideshow code to allow an entire directory of images to be loaded without specifying a number of photos?
This script still doesn't work for me with FX... anyway.Where you would normally have the array values:Code:<?php // getpics.php $directory = "images"; // Directory in which the images are stored, relative to the location of this script. Must have the slash. header("Content-Type: text/javascript"); $dir = opendir($directory); while($file = readdir($dir)) if(strpos($file, ".") === 0) continue; else echo("fadeimages[0]=['$directory/$file', '', ''];\n"); ?>Make sure getpics.php is in the same directory as the page containing the script, and change the $directory variable to point to the directory.Code:</script><script src="getpics.php" type="text/javascript"></script><script>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Thank you very much! I shall try that out!
Nelson
Made a slight error. Should be:Code:<?php // getpics.php $directory = "images"; // Directory in which the images are stored, relative to the location of this script. Must have the slash. header("Content-Type: text/javascript"); $dir = opendir($directory); for($i=0;$file = readdir($dir);$i++) if(strpos($file, ".") === 0) continue; else echo("fadeimages[$i]=['$directory/$file', '', ''];\n"); ?>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Please forgive my stupidity, but I did something wrong.
I placed your code in a PHP file - getpics2.php (I already had a getpics from the photo album script). I changed the directory link to "/Graphics" where I store the files, and I added the line of invocation where the array definitions were. (see below), and I am getting error messages. What did I do wrong? Thanks.
<script type="text/javascript">
/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script><script src="getpics2.php" type="text/javascript"></script><script>
////NO need to edit beyond here/////////////
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
It needs to be relative to the script, because / is a different place from the points of view of the script and the browser.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I'm still getting a syntax error and an error that fadeimages1 and 2 are undefined.
May we see your page?
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
http://www.protestantlawyersny.org/test.htm
is the test page I made.
and the getpics2.php script is:
<?php
// getpics.php
$directory = "Graphics/Thumbnails/"; // Directory in which the images are stored, relative to the location of this script. Must have the slash.
header("Content-Type: text/javascript");
$dir = opendir($directory);
for($i=0;$file = readdir($dir);$i++)
if(strpos($file, ".") === 0) continue;
else echo("fadeimages[$i]=['$directory/$file', '', ''];\n");
?>
Bookmarks