$jpg_arr = glob('*.{j,J}{p,P}{e,E,}{g,G}', GLOB_BRACE);
$jpg_count = 0;
FOREACH ($jpg_arr as $thisJPG) :
IF (is_file($thisJPG)) :
$jpg_count++;
ENDIF;
ENDFOREACH;
echo $jpg_count . ' jpeg files in directory.';
The code posted by Installer will likely work for you without my addition. My modifications only help to ensure that you're not counting directories which may match the file pattern searched (such as a directory called 'BACKUP.JPG', for example).