'/~noemie/list_dir/audio.gif', 'dir' => '/~noemie/list_dir/dir.gif', 'dvi' => '/~noemie/list_dir/dvi.gif', 'html' => '/~noemie/list_dir/html.gif', 'misc' => '/~noemie/list_dir/misc.gif', 'pdf' => '/~noemie/list_dir/pdf.gif', 'ppt' => '/~noemie/list_dir/ppt.gif', 'word' => '/~noemie/list_dir/word.gif', 'ps' => '/~noemie/list_dir/ps.gif', 'source' => '/~noemie/list_dir/source.gif', 'xls' => '/~noemie/list_dir/xls.gif', 'txt' => '/~noemie/list_dir/text.gif', 'video' => '/~noemie/list_dir/video.gif', 'movie' => '/~noemie/list_dir/mov.gif', 'xml' => '/~noemie/list_dir/xml.gif', 'zip' => '/~noemie/list_dir/zip.gif', 'img' => '/~noemie/list_dir/image.gif' ); // Get the files and directory $path = "./"; $dir_handle = opendir($path) or die ("Unable to open $path"); while($file = readdir($dir_handle)) { if($file == "." || $file == ".." || $file == "index.php") { continue; } elseif (is_dir($file)) { $dirs[] = $file; } elseif (preg_match("/\.(jpg|gif|png)$/i", $file)) { $images[] = $file; } else { $files[] = $file; } } closedir($dir_handle); // Display headers echo "\n\n"; echo "\n"; echo "\n\n"; // Show thumbnails of images sort ($images); foreach ($images as $img) { echo "   \n"; } echo "\n\n"; // Auxiliary functions function list_files ($array, $icons) { if (!$array) { return; } sort ($array); foreach ($array as $item) { // find type of echo "\n"; echo "$item\n"; echo "". date ("M d Y H:i:s", filemtime($item)) . "\n"; echo "" . filesize_format(filesize($item)) . "\n"; } } function filesize_format($bytes, $format = '', $force = '') { $force = strtoupper($force); $defaultFormat = '%01d %s'; if (strlen($format) == 0) $format = $defaultFormat; $bytes = max(0, (int) $bytes); $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); $power = array_search($force, $units); if ($power === false) $power = $bytes > 0 ? floor(log($bytes, 1024)) : 0; return sprintf($format, $bytes / pow(1024, $power), $units[$power]); } ?>