function listdir($dir = '.') { $contents = glob(join_path($dir, '*')); $dirs = array(); $files = array(); foreach ($contents as $file) { $tmp = alt_stat($file); if ($tmp['filetype']['is_dir']) { $dirs[] = $tmp; } else { $files[] = $tmp; } } return array_merge($dirs, $files); }
$path_img = pathinfo($url); createThumbs("../images/misc/", "../images/misc/thumbs/", 150); /* echo $path_img['dirname'], "\n"; echo $path_img['basename'], "\n"; echo $path_img['extension'], "\n"; */ echo "<div class=\"ui-finder-file-preview file-preview\">" . "<p class=\"ui-finder-image content_updown down\">" . "<span class=\"triangle_updown down\">Prévisualiser</span>" . "<img src=\"" . $urlImg . "\" id=\"vign_wlpper\" class=\"float_left finder_img\" /></p>"; echo "<div class=\"img_infos\"><a name=\"moreInfosFile\"></a><h3 class=\"img_name\">" . ucfirst(preg_replace('/_/', ' ', $path_img['filename'])) . "</h3>" . "<em>" . $path_img['filename'] . "." . $path_img['extension'] . "</em>"; // depuis PHP 5.2.0 // $p=="finder.png"? $padd="padding-left:175px;": $padd="padding-left:0;"; $padd = "padding-left:0;"; $res .= "<div style=\"" . $padd . "\">"; // $MetaTags=alt_stat(preg_replace("/core/","..",$url)); // $eXimg=exif_read_data(preg_replace("/core/","..",$url)); $MetaTags = alt_stat(preg_replace("/core/", "..", preg_replace("/thumbs/", "", preg_replace("/\\.\\.\\/~" . $user_ . "/", "/home/" . $user_ . "/public_html", $url_)))); $ext = pathinfo($url, PATHINFO_EXTENSION); $eDate = array('/Feb/', '/Apr/', '/May/', '/Jun/', '/Jul/', '/Aug/'); $fDate = array('Fev', 'Avr', 'Mai', 'Juin', 'Juil', 'Aout'); $res .= '<ul>'; $res .= "<li><img src=\"images/app/" . $ext . ".png\" style=\"width:64px;\" width=\"64\"/></li>"; $res .= "<li><strong>Taille : </strong>" . round($MetaTags['size']['size'] / 1000, 1) . " Ko</li>"; $res .= "<li><strong>Type : </strong>" . mime_content_type(preg_replace("/core/", "..", preg_replace("/thumbs/", "", preg_replace("/...\\/~" . $user_ . "/", "/home/" . $user_ . "/public_html", $url_)))) . "</li>"; if (mime_content_type(preg_replace("/core/", "..", preg_replace("/thumbs/", "", preg_replace("/...\\/~" . $user_ . "/", "/home/" . $user_ . "/public_html", $url_)))) == "image/jpeg") { $eXimg = exif_read_data(preg_replace("/core/", "..", preg_replace("/thumbs/", "", preg_replace("/...\\/~" . $user_ . "/", "/home/" . $user_ . "/public_html", $url_)))); $resCopy = "<li><strong>Copyright :</strong> " . $eXimg['COMPUTED']['Copyright'] . "</li>"; $res .= "<strong>Dim.</strong> : " . $eXimg['COMPUTED']['Width'] . "x" . $eXimg['COMPUTED']['Height'] . " pixels<br />"; } $res .= $resCopy; $res .= '</ul>'; // echo "<strong>Hauteur</strong> : ".$eXimg['COMPUTED']['Height']." pixels<br />";
function scan_directory_recursively($directory, $filter = FALSE) { if (substr($directory, -1) == '/') { $directory = substr($directory, 0, -1); } if (!file_exists($directory) || !is_dir($directory)) { return FALSE; } elseif (is_readable($directory)) { $directory_tree = array(); $directory_list = opendir($directory); while ($file = readdir($directory_list)) { if ($file != '.' && $file != '..') { $path = $directory . '/' . $file; if (is_readable($path)) { $subdirectories = explode('/', $path); if (is_dir($path)) { $directory_tree[] = array('path' => $path, 'name' => end($subdirectories), 'kind' => 'directory', 'details' => alt_stat($path)); //'content' => scan_directory_recursively($path, $filter)); } elseif (is_file($path)) { $finfo = explode('.', end($subdirectories)); $extension = end($finfo); if ($filter === FALSE || $filter == $extension) { $directory_tree[] = array('path' => $path, 'name' => end($subdirectories), 'extension' => $extension, 'size' => filesize($path), 'kind' => 'file', 'details' => alt_stat($path)); } } } } } closedir($directory_list); return $directory_tree; } else { return FALSE; } }