Grabbing images from a folder is more a job for PHP. And it's less of an issue which version of PHP you are familiar with than of which version is available to you on the server. This should work in PHP 4 or 5:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="swissarmy.js" type="text/javascript">
/***********************************************
* Swiss Army Image slide show script - © John Davenport Scheuer: http://home.comcast.net/~jscheuer1/
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full original source code
***********************************************/
</script>
<script type="text/javascript">
<?php
function returnimages(){
$dirname = './pics_bak/'; //relative path to image folder
$pattern = '#\.(jpg|jpeg|png|gif|bmp)$#i';
$files = array();
if($handle = opendir($dirname)){
while(($file = readdir($handle)) !== false){
if(preg_match($pattern, $file)){
array_push($files, "\t['" . $dirname . $file . "', '', '']");
}
}
closedir($handle);
natsort($files);
}
return "inter_slide.slides = [\n" . implode(",\n", $files) . "\n];\n";
}
echo returnimages();
?>
inter_slide.slides.reverse(); // reverse the order of the array of images
var preload_ctrl_images=false; //if true, set paths to the control images
//Optional Options for the slideshow:
inter_slide.slides.no_descriptions=1; //use for no descriptions displayed
inter_slide.slides.pause=1; //use for pause onmouseover
inter_slide.slides.fadecolor='#111'; //will set fading images background color, defaults to white
</script>
</head>
<body>
<script type="text/javascript">
new inter_slide(inter_slide.slides, 800, 650)
</script>
</body>
</html>
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
Bookmarks