Example
Directory to examine: http://ivanwlam.com/experiments/files/programming/2009/090713-readdir/screenSlideShow/
First: read off all the entries in the directory.
file or directory name: . || filetype: dir || This is not a file.
file or directory name: .. || filetype: dir || This is not a file.
file or directory name: screenBank || filetype: dir || This is not a file.
file or directory name: img01.jpg || filetype: file || This is a file! || filesArray count: 1
file or directory name: img02.jpg || filetype: file || This is a file! || filesArray count: 2
file or directory name: img03.jpg || filetype: file || This is a file! || filesArray count: 3
file or directory name: phpfile.php || filetype: file || This is a file! || filesArray count: 4
file or directory name: _notes || filetype: dir || This is not a file.
file or directory name: liveConstBucket.png || filetype: file || This is a file! || filesArray count: 5
file or directory name: workNighterWPre.swf || filetype: file || This is a file! || filesArray count: 6
file or directory name: index.php || filetype: file || This is a file! || filesArray count: 7
file or directory name: liveConstCodeAnimated.gif || filetype: file || This is a file! || filesArray count: 8
file or directory name: 081102-125x20grid.png || filetype: file || This is a file! || filesArray count: 9
filesArray count total: 9
Second: Only show the image-based files
fileArray index: 0 || file type index: 2 || Image Type: JPEG || imgArray count: 1

fileArray index: 1 || file type index: 2 || Image Type: JPEG || imgArray count: 2

fileArray index: 2 || file type index: 2 || Image Type: JPEG || imgArray count: 3

fileArray index: 3 || file type index: || Image Type: || imgArray count: still 3
This is not an image file.
fileArray index: 4 || file type index: 3 || Image Type: PNG || imgArray count: 4

fileArray index: 5 || file type index: 13 || Image Type: SWC || imgArray count: 5
The file (workNighterWPre.swf) is not a GIF, JPG, nor a PNG
fileArray index: 6 || file type index: || Image Type: || imgArray count: still 5
This is not an image file.
fileArray index: 7 || file type index: 1 || Image Type: GIF || imgArray count: 6

fileArray index: 8 || file type index: 3 || Image Type: PNG || imgArray count: 7

imgArray count total: 7
[...] Helper PHP File in the code is the packaged version of Displaying Images from a Directory, which I just demo’d in the previous [...]