I found this: http://www.php.net/manual/en/function.finfo-file.php.
<?php
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
if substr(finfo_file($finfo, $filename), 0, 6) == "image"
printf("%s is an image file.", $filename);
}
finfo_close($finfo);
?>
Also, like Pekka's comment says, you are mixing up your title and your question. If you want to find out the content type of a particular file, you can use the code snippet I provided.
Otherwise, it just sounds like you want to see if an extension to a file is indicative of it being an image. Then, you would just want to test for the existence of the string in an array of pre-defined extensions:
<?php
$imageExtensions = array('jpg', 'gif', 'png', ....);
$someFileExtension = 'jpg';
if in_array($someFileExtension, $imageExtensions)
printf("%s is an extension indicative of an image file.", $someFileExtension);
?>