$file = 'путь';
$image = imagecreatefromstring(file_get_contents($file));
$array = array_map('realpath', glob('*.*'));
echo '<pre>' . print_r($array, true) . '</pre>';
$resource = imagecreatefromstring(file_get_contents($array[1]));
echo get_resource_type($resource);