I presume that you're doing something along the lines of
find files in dir
for each file:
{
put in <tr>'s and <td>'s etc
output <img>
put in </td> and </tr>
}
why not do something like (in a bit of pigeon code, but you should get the idea):
$count = 0;
$num_across = 3;
for each file
{
if($count==0)
echo "<tr>"
echo "<td><img src=...></td>";
if($count==($num_across-1))
{
echo "</tr>\n";
$count = -1;
}
$count++;
}
that should give you 3 images across before going to a new row. If you want more, then simply change the $num_across value.