Code: Select all
$result = glob("/home/guttersg/www/images/clothing/sold/th_*.jpg");
foreach ($result as $filename) {
echo "<td align=\"center\">\n";
preg_match('#^.*?_(\d+)\.(jpg|png)$#',$filename,$match);
echo "<A HREF=\"javascript:popUp('http://www.guttersgoods.com/gallery.php?ProductID=".$match[1]."')\"><img border=0 class=galleryimg width=112px height=150px src=\"/images/clothing/sold/".basename($filename)."\"></a>\n";
echo "</td>\n";
if ($i == 4){
echo "</tr>\n<tr>\n";
$i = 1;
}else{
$i++;
}
}