Hi, I myself use the below code, what it does is this.
I allow people to upload images in to a directory,
All images in that directory get displayed on a webpage 1 at a time I have set a timer to 4 seconds.
So create a php file make sure it is empty then add the following code to it. You can see in the code below the php file is called getimages.php do not change any code in the file below you need to put this code in the same folder as your images.
PHP Code:
<?
//PHP SCRIPT: getimages.php
Header("content-type: application/x-javascript");
//This function gets the file names of all images in the current directory
//and ouputs them as a JavaScript array
function returnimages($dirname=".") {
$pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)"; //valid image extensions
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){ //if this file is a valid image
//Output it as a JavaScript array element
echo 'galleryarray['.$curimage.']="'.$file .'";';
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo 'var galleryarray=new Array();'; //Define array in JavaScript
returnimages() //Output the array elements containing the image file names
?>
The next part is the code we need to place in the document where we want the images to display. I myself have created a table on the page where I want my images to display and put this code in to that. Now the code below you will need to change some info. So remember where I have used "pics" that is because the directory where my images are stored is called "pics" without the quotes. You would need to change that to the name of your directory.
PHP Code:
<script src="pics/getimages.php"></script>
<script type="text/javascript">
var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", "pics/"+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}
window.onload=function(){
setInterval("rotateimages()", 4500)
}
</script>
<div style="width: 125px; height: 125px">
<img id="slideshow" src="pics/bear.gif" /></div>
If I have got the wrong idea about what you want take no notice of me

oh one last thing the very last line of code you see above looks like
<img id="slideshow" src="pics/bear.gif" /></div>
You will see I have specified the name of a particular gif image that is because my slide show will always start with that image