/*
* This little example prints a sorted directory
* listing, with dirs first and files afterwards.
*/
// Open current directory
if($handle = opendir("../albums/drawings")){
// Loop through all files
while(false !== ($file = readdir($handle))){
// Ignore hidden files
if(preg_match ("/thumb/", $file)){
// Put dirs in $dirs[] and files in $files[]
if(is_dir($file)){
$dirs[] = $file;
}else{
$files[] = $file;
}
}
}
// Close directory
closedir($handle);
// if $files[] exists, sort it and print all elements in it.
$i = 0;
if(is_array($files)){
rsort($files);
while ($i < 5) {
$test = substr($files[i],0,3);
$target_dir="../gallery/drawings";
$thumb_dir="../albums/drawings";
$target_url=substr($files[$i], 0, 3);
echo "
";
echo "";
$i++;
}
}
}
?>