dovrebbe funzionareCodice PHP:
<?php
$i = 0;
$num_col = 5;
$dir = "immagini";
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
echo "<table>";
while (($file = readdir($handle))) {
if((!is_dir($file))&($file!=".")&($file!="..")) {
if ($i%$num_col == 0) { echo "<tr>"; }
echo "<td><img src=\"immagini/".$file."\" width=\"100\" height=\"100\"></td>";
if (($i+1)%$num_col == 0) { echo "</tr>"; }
$i++;
}
}
closedir($directory_handle);
if (($i+1)<$num_col) {
while (($i+1)<$num_col) {
echo "<td></td>";
$i++;
}
echo "</tr>";
}
echo "</table>";
}
}
?>