I am building an image viewer where PHP returns a list of the images in a directory, and passes that on to Flash, where the images are loaded dynamically.
My question is, is there a way to verify that the current file that PHP is reading is of type image/jpeg? In other words, if I have a text file, a gif file, and an HTML file with all my JPEG's in that directory, I want PHP to skip everything that is not image/jpeg?
Does PHP support such a function? I'm thinking my best bet is to use getimagesize() since that will return the correct MIME-type. And if it's not, it will return NULL and generate an error. Can I supress this with '@'? I've never used this function before.
Can anyone give some ideas on the best way to go about this?