hey all.

i am using the following function to count the number of files in a specified directory:
//=> Opens specified DIR and counts the files or folders within it.
function getFileCount ($type,$dir='./'){
		if (($type == 'file') || ($type == "link") || ($type == 'dir')) {            
		  if (is_dir($dir)) {      
			$fd = opendir($dir);
			while ($part = readdir($fd)) {
			  if ($part != "." && $part != "..") {
				$function = 'is_' . $type;
				if ($function($dir . $part))  {
		  }else{ $err = $dir . ' is not a directory'; }   
		}else{ $err = $type . ' is unknown type -- must be file,link or dir'; }                 
		if (isset($err)) {   
			Return $err;
			Return $count;
		Example Use
		print getFileCount('file','thumbs/');   
		print getFileCount('file','full_size/');   
it works file. except im having trouble making it show ONLY jpeg files.
im using this for a gallery im writing.

i have something like this on my index.php page:

	if ((getFileCount('file',"$file/")) < (getFileCount('file',"$file/thumbs/"))) {
	echo "too many thumbs";
	}elseif((getFileCount('file',"$file/")) > (getFileCount('file',"$file/thumbs/"))) {
		echo "<a href=\"thumb.php?file=$file\">Make Thumb</a>";
	}elseif((getFileCount('file',"$file/")) == (getFileCount('file',"$file/thumbs/"))) {
		echo "DONE!";
the function should count the number of files in the FULL_SIZE directory and also the THUMBS directory.
if FULL_SIZE == THUMBS, then nothing needs to be done.

but if FULL_SIZE > THUMBS, then thumbnails need to be created.
<< with the code posted here in my other thread: http://www.sitepoint.com/forums/showthread.php?t=211101 >>

then i came to realize that the thumb.php file needs to reside in the FULL_SIZE folder and i got it to create the THUMBS folder, if it doesnt already exist.

my problem is that i am trying to get my getFileCount function to ONLY count the jpegs.

any help would be dearly appreciated.