/*
* This grabs all thumbnails from a specified directory
* sorts them in reverse order and displays the last 7 files
* The files are displayed with their thumbnail href'd to the gallery page
* and the images are auto-sized down to 60pixels width, auto-height using
* css2
*/
// Open nested album absolute path
if($handle = opendir("/home/p/pthree/diversionmary.com/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 nested album
closedir($handle);
// if $files[] exists, sort it and print last N elements in it, reverse order.
$i = 0;
if(is_array($files)){
rsort($files);
//specify how many items should be displayed number must be less than
//or equal to objects in gallery
while ($i < 7) {
//specify where the nested album is displayed
$target_dir="http://diversionmary.com/gallery/drawings";
//specify where the item's thumbnail exists
$thumb_dir="http://diversionmary.com/albums/drawings";
//specify the object's identity for href, do not modify
$target_url=substr($files[$i], 0, 3);
//specify how the output will look. currently thumbnails will be 60px wide
//with 2 line breaks.
echo "
";
echo "";
$i++;
}
}
}
?>