Script for Butt-Simple Photo Gallery http://www.blazonry.com/scripting/photos1_how.php "; //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 (false !== ($file = readdir($handle))) { if ($strSought == substr($file, -3)) { $imgNum++; $size = GetImageSize($file); $jpglink = substr($file, 0, 8); echo ""; //modulus (%) $a % $b remainder of $a divided by $b if ($imgNum%$perRow) { echo ""; } else { echo ""; } } } closedir($handle); echo ""; } ?>