Réponse à bala
J'ai rectifié le code deja existant pour afficher le nom de l'image aussi:
(Ume image chaque 4 secondes)
"
<head>
<title>Defilement images</title>
<meta name="author" content="Wassim Jied coderspirit.blogspot.com" />
</head>
<body onLoad="rotate();">
<?php
$directory_name = "images";
$extensions_ok = array ( ".jpg","jpeg",".gif",".png");
$folder = opendir ($directory_name);
$filesNames = array();
while ($file = readdir ($folder))
{
if (in_array(strtolower(substr($file, -4)),$extensions_ok))
$filesNames[] = $file;
}
closedir ($folder);
sort($filesNames);
$count_photos = count ($filesNames);
?>
<script type="text/javascript">
var rotate_delay = 4000; // delais en microseconde (4000 = 4 secs)
var baseName = "<?php echo $directory_name;?>";
var current = -1;
var filesNames = [<?php for($i=0;$i<$count_photos;$i++)
{
echo "\"".$filesNames[$i]."\"";
if($i!=$count_photos-1) echo ",";
}
?>];
function next() {
if (current<filesNames.length - 1)
++current;
else current = 0;
}
function rotate() {
if(filesNames.length > 0)
{
next();
document.images.slides.src = baseName+"/"+filesNames[current];
document.all("fileName").innerText = filesNames[current];
window.setTimeout("rotate()", rotate_delay);
}
}
</script>
<center>
<table>
<tr>
<td>
<img src="/" id="slides" width=120px height=120px/>
</td>
</tr>
<tr>
<td id="fileName">
</td>
</tr>
</table>
"