OK, we are half way home on the PHP support front. There may still be issues with your host not allowing folder reads and filename retrieval, but that is unusual, so let's not worry about that unless it happens. That said, here is the PHP file to use:
PHP Code:
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname="./images/") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
echo 'galleryarray[' . $curimage .']=["' . $dirname . $file . '"];' . "\n";
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo "var galleryarray=new Array();" . "\n";
returnimages();
?>
Save it as - say, getpics.php and notice this line:
Code:
function returnimages($dirname=".
/images/
") {
the .
represents the folder that your page is in, the /images/
is the folder off of the folder where your page is that contains the images. Edit that if need be to reflect the actual folder name (it must be a folder off of the folder in which your page is located), and upload the getpics.php file to the same folder as your page. Place this tag in the head of your page before the slide show's initialization:
Code:
<script type="text/javascript" src="getpics.php"></script>
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [470, 502], //width . . .
Then for the init, use:
Code:
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [470, 502], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: galleryarray,
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
Bookmarks