// You can get the filecount like so:
$directory = "/path/to/dir/";
$filecount = 0;
$files = glob($directory . "*");
if ($files){
$filecount = count($files);
}
echo "There were $filecount files";
// where the "*" is you can change that to a specific filetype if you want like "*.jpg" or you could do multiple filetypes like this:
// the GLOB_BRACE flag expands {a,b,c} to match 'a', 'b', or 'c'
// glob($directory . "*.{jpg,png,gif}",GLOB_BRACE);