Album photo sur plusieurs pages.
Posté : 16 janv. 2007, 00:09
Bonjour j'ai un script de photo basique mais je souhaiterais n'afficher que x photos alors que le sript actuel m'affiche toutes les photos dans la page
avec un lien suivant et precedent !!!!
Voila le script que j'utilise:
avec un lien suivant et precedent !!!!
Voila le script que j'utilise:
<html>
<head>
<title>Galerie Photo</title>
</head>
<body>
<?php
$tableau = array();
$dossier = opendir ('./pics/');
while ($fichier = readdir ($dossier)) {
if ($fichier != '.' && $fichier != '..' && $fichier != 'index.php') {
$tableau[] = $fichier;
}
}
closedir ($dossier);
$nbcol=4;
$nbpics = count($tableau);
if ($nbpics != 0) {
echo '<table align="center">';
for ($i=0; $i<$nbpics; $i++){
if($i%$nbcol==0) echo '<tr>';
echo '<td><a href="pics/' , $tableau[$i] , '"><img src="mini.php?f=' , $tableau[$i] , '" alt="Image" /></a></td>';
if($i%$nbcol==($nbcol-1) or $i==($nbpics-1)) echo '</tr>';
}
echo '</table>';
}
else echo 'Aucune image à afficher';
?>
</body>
</html>
Merci.