"; //Note: readdir returns filenames in the order in which they are // stored by the filesystem. Future enhancement: sort by filename // (sequence they were shot) while ($file = readdir($handle)) { if ($strSought == substr($file, -3)) { $imgNum++; $size = GetImageSize("./thumbs/".$file); $jpglink = substr($file, 3); echo ""; //modulus (%) $a % $b remainder of $a divided by $b if ($imgNum%$perRow) { echo ""; } else { echo ""; } } } closedir($handle); echo ""; } ?>