This is a PHP code that displays all the images in a directory. I've used a code similar to this that worked, but it didn't start a new row after 4 images, so I had to get a new code. This code looks like it should work, but it doesn't show anything at all. Maybe someone can point out what might be wrong with it. Here is the code:
<?php
$username = substr(dirname($_SERVER['PHP_SELF']), 8);
$images = glob("$username/*.*");
$nrimg = 1;
echo '<table><tr>';
for ($i=0; $i<count($images); $i++){
$image = $images[$i];
if($nrimg > 4) {
echo '</tr><tr>';
$nrimg = 1;
}
echo '<td><img src="'.$image.'" width="50" height="50"></td>';
$nrimg++;
}
echo '</tr></table>';
?>
<?php
$username = substr(dirname($_SERVER['PHP_SELF']), 8);
$images = glob("$username/*.*");
$nrimg = 1;
echo '<table><tr>';
for ($i=0; $i<count($images); $i++){
$image = $images[$i];
if($nrimg > 4) {
echo '</tr><tr>';
$nrimg = 1;
}
echo '<td><img src="'.$image.'" width="50" height="50"></td>';
$nrimg++;
}
echo '</tr></table>';
?>