".") && ($file <> "..")) { $filearray[] = $file; } } sort($filearray); foreach($filearray as &$file){ $ext = substr($file, strlen($file) - 3); if ($ext == "jpg" || $ext == "png" || $ext == "gif") { $count++; $cur_img = "$gid/$file"; ?>