ignore a file name in php array -
im pretty new php, found gallery script takes photos folder , displays them. i'm trying make array ignore folders in 'photos' folder named 'app_thumbnails'.
the code creating array is:
//read files , folders $files = array(); $dirs = array(); if ($handle = opendir($currentdir)) { while (false !== ($file = readdir($handle))) { // change filename display date $displaydate= date('js m y', strtotime($file)); // load folders array if (is_directory($currentdir . "/" . $file)) { if ($file != "." && $file != ".." ) { // set thumbnail folder.jpg if found: if (file_exists(gallery_root . "photos/" . $file . "/folder.jpg")) { $dirs[] = array( "name" => $file, "date" => filemtime($currentdir . "/" . $file), "html" => "<li><a href='?dir=" . urlencode(ltrim($_get['dir'] . "/" . $file, "/")) . "'><em> " . $displaydate . "</em><span></span><img src='" . gallery_root . "createthumb.php?filename=photos/" . $file . "/folder.jpg&size=$thumb_size' alt='$label_loading' /></a></li>"); } else { //set thumbnail first image found (if any): unset ($firstimage); $firstimage = getfirstimage("$currentdir/" . $file); if ($firstimage != "") { $dirs[] = array( "name" => $file, "date" => filemtime($currentdir . "/" . $file), "html" => "<li><a href='?dir=" . urlencode(ltrim($_get['dir'] . "/" . $file, "/")) . "'><em> " . $displaydate . "</em><span></span><img src='" . gallery_root . "createthumb.php?filename=$thumbdir/" . $file . "/" . $firstimage . "&size=$thumb_size' alt='$label_loading' /></a></li>"); } else { //if no folder.jpg or image found, display default icon: $dirs[] = array( "name" => $file, "date" => filemtime($currentdir . "/" . $file), "html" => "<li><a href='?dir=" . urlencode(ltrim($_get['dir'] . "/" . $file, "/")) . "'><em> " . $displaydate . "</em><span></span><img src='" . gallery_root . "images/folder_" . strtolower($folder_color) . ".png' width='$thumb_size' height='$thumb_size' alt='$label_loading' /></a></li>"); } } } }
you can see gallery example here: http://design-wright.co.uk/bunker/gallery/gallery.php
thanks time guys. alsweet
try replacing following:
if ($file != "." && $file != ".." )
by
if ($file != "." && $file != ".." && $file != 'app_thumbnails')
Comments
Post a Comment