Hi Folks.
Question: I have a small script that reads a directory and creates small thumbnails. It is simple and easy to use. However, at the moment, it creates a single column of thumbnails.
My question, and request for help, is I would like to have maybe 3 images per table row, rather than the single image.
Here is the existing function.
and a link to it in action.. http:www.azazeal.com/tats/
<?php
function dirListing($path)
{
if ($handle = opendir($path))
{
$news_row_1 = "#F0EBEB";
$news_row_2 = "#FFFFFF";
$count_rows = "0";
while (false !== ($file = readdir($handle)))
{
$count_rows++;
if ($count_rows%2==0)
{
$row_color="$news_row_1";
} // Even-numbered rows
else
{
$row_color="$news_row_2";
} // Odd-numbered rows
if ($file != "." && $file != "..")
{
?>
<table align="center" border="0" width="70%" cellspacing="2" cellpadding="4">
<tr bgcolor="<?php echo $row_color; ?>">
<td width="80%" class="news" align="center">
<?php
$t="<a href=$path/$file target=_blank><img src=$path/$file width=80 height=60 border=0></a>";
echo $t."</td>" ; //--File Name
}
}
}
closedir($handle);
}
?>
Any help with this would be appreciated.
I was think perhaps, counting the number of files or something.
Another way would be to have two folders that have the images, and define two variables, from each folder, and have them in the table row.
Thanks!