//array of image file types
$fileType_array = array(IMAGETYPE_JPEG, IMAGETYPE_PNG);
//getimagesize to determine the file_type of the image
$getImage_thumbnail = getimagesize($_FILES[$thumbnail_fieldname]['tmp_name']);
$getImage_thumbnail_type = $getImage_thumbnail[2];
$getImage_desktop_1280x800 = getimagesize($_FILES[$desktop_fieldname_1280x800]['tmp_name']);
$getImage_desktop_1280x800 = $getImage_desktop_1280x800[2];
$getImage_desktop_1366x768 = getimagesize($_FILES[$desktop_fieldname_1366x768]['tmp_name']);
$getImage_desktop_1366x768 = $getImage_desktop_1366x768[2];
$getImage_desktop_1920x1080 = getimagesize($_FILES[$desktop_fieldname_1920x1080]['tmp_name']);
$getImage_desktop_1920x800 = $getImage_desktop_1920x1080[2];
if(in_array($getImage_thumbnail_type, $fileType_array, TRUE)){
echo "<p>Thumbnail is an image.</p>";
}
Above is my code to check if the files selected to upload are images, what I would like to do is use in_array just once not several if statements/in_array to check if the file type exists in the array. How can that be?