Hi, I'd like to fix up my photo section a little bit but I'm lost on where to go as far as adding my ideas in the code. First off I just have it so it reads the files from a directory and displays the thumbnail on the page with the link to the larger version. Here's the code....
<?
$dirpath = "cms/upload/images/media_images/".$gal."/";
$dir = opendir($dirpath);
$files = array();
while ($file = readdir($dir)) {
$localpath = $dirpath.$file;
if (is_file($localpath)) {
$key = filemtime($localpath).md5($file);
$files[$key] = $file;
}
}
sort($files);
foreach ($files as $file) {
echo "<a href=javascript:openCenterWin(\"http://stilldeciding.com/show_photo.php?photo=$file\",650,650);><img border=\"1\" src=\"http://stilldeciding.com/cms/upload/images/thumb.php?file=media_images/$file&size=50\" hspace=\"1\" vspace=\"1\" align=\"absmiddle\"></a> ";
}
?>
What I would like to do is for every photo returned from the directory give it it's table cell, I.E.
<td align=\"center\" valign=\"middle\">"<a href=javascript:openCenterWin(\"http://stilldeciding.com/show_photo.php?photo=$file\",650,650);><img border=\"1\" src=\"http://stilldeciding.com/cms/upload/images/thumb.php?file=media_images/$file&size=50\" hspace=\"1\" vspace=\"1\" align=\"absmiddle\"></a></td>
Now what I would like to do with that is limit the cells per row. So say I only want 4 photos in row and I have about 9. I would like it to create 3 rows. Then a third row for the extra pic, but also create an additional 3 cells to fill in the gap. Hope you understand what I'm looking to do. I could probably explain it alot better but I'm not very good at this haha, so sorry.
Hope someone can help me. Thanks in advance!
Evan