1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <SCRIPT LANGUAGE="JavaScript">
table_photo = new Array;
table_noms = new Array;
table_type = new Array;
<?
$a = 0;
$handle = opendir("galerie");
while (($file = readdir())!=false) {
clearstatcache();
if($file!=".." && $file!=".")
{
// RECHERCHE DU FICHIER
echo "table_photo[$a] = 'galerie/$file';";
// RECHERCHE DU TYPE DE FICHIER
$file_type = strrchr($file, ".");
$file_type = str_replace(".", "", $file_type);
$file_type = strtoupper($file_type);
echo "table_type[$a] = '$file_type';";
// RECHERCHE DU NOM :
$file_name = strtolower($file);
$file_name = str_replace(".jpg", "", $file_name);
$file_name = str_replace(".jpeg", "", $file_name);
$file_name = str_replace(".gif", "", $file_name);
$file_name = str_replace(".png", "", $file_name);
echo "table_noms[$a] = '$file_name';";
$a++;
}
}
closedir($handle);
?>
function showing_photos(num)
{
if(document.getElementById)
{
diaporama_fin = "";
if(num!=0)
diaporama_fin += "<td height=20><p align=left><A HREF=# onClick='showing_photos("+(num-1)+");return(false)'><img border=0 src=prec.jpg></A></td>";
if(num!=(table_photo.length-1))
diaporama_fin += "<td height=20><p align=right><A HREF=# onClick='showing_photos("+(num+1)+");return(false)'><img border=0 src=suiv.jpg></A></td>";
document.getElementById("affichage_photos").innerHTML = "<div align=center><center><table border=0 width=640 cellspacing=0 cellpadding=5 height=500><tr><td colspan=2 valign=middle width=100% bgcolor=#999999 height=20><table border=0 width=100% cellspacing=0 cellpadding=0><tr><td width=50%>Infos : "+table_noms[num]+"</td><td width=50%></td></tr></table></td></tr><tr><td width=100% colspan=2 valign=middle height=380><table border=0 width=100% cellspacing=1 cellpadding=0 bgcolor=#FF6600 height=100%><tr><td width=100% bgcolor=#CCCCCC height=380><center><img src='"+table_photo[num]+"' BORDER=0></center></td></tr></table></td></tr><tr>"+diaporama_fin+"</tr></table></center></div>";
}
}
window.onload = new Function("showing_photos(0)")
</SCRIPT>
Ou bien si quelqu'un avais un code pour réaliser un diaporama javascript/php personnalisable mais surtout administrable. |
Partager