Révision c0db737e
Ajouté par Jocelyn Delande il y a presque 11 ans
class/utils.class.php | ||
---|---|---|
15 | 15 |
set_error_handler('errorToException'); |
16 | 16 |
} |
17 | 17 |
|
18 |
static public function list_available_panos($base_dir) { |
|
19 |
$dir = opendir($base_dir); |
|
20 |
$ret = array(); |
|
21 |
$finfo = finfo_open(FILEINFO_MIME_TYPE); // Retourne le type mime du fichier |
|
22 |
|
|
23 |
while(false !== ($filename = readdir($dir))) { |
|
24 |
if (!preg_match('/^\.\.?$/', $filename)) { |
|
25 |
$ftype = finfo_file($finfo, $base_dir.'/'.$filename); |
|
26 |
if (isset($ftype)) { |
|
27 |
$pano = array( |
|
28 |
'comment' => $filename, |
|
29 |
'title' => sprintf('fichier de type %s', $ftype) |
|
30 |
); |
|
31 |
} else { |
|
32 |
$pano = array( |
|
33 |
'comment' => sprintf('<samp>%s</samp>', $filename), |
|
34 |
'title' => '' |
|
35 |
); |
|
36 |
} |
|
37 |
$pano['filename'] = $filename; |
|
38 |
$ret[] = $pano; |
|
39 |
} |
|
40 |
} |
|
41 |
return $ret; |
|
42 |
} |
|
18 | 43 |
} |
44 |
|
|
45 |
?> |
Formats disponibles : Unified diff
separate function for listing available images