Checks that the file is recognized by image_get_info() as an image.
$file: A Drupal file object.
An array. If the file is not an image, it will contain an error message.
function file_validate_is_image(stdClass $file) {
$errors = array();
$info = image_get_info($file->uri);
if (!$info || empty($info['extension'])) {
$errors[] = t('Only JPEG, PNG and GIF images are allowed.');
}
return $errors;
}