/* version history 0.1: first release 0.2: added titles array. cleaned up array creation in php */ ?>
// PHP part
// setup album_name, pictures array and titles array
$album = $_GET['album'];
$album = str_replace('.','',$album); // protection
$e = split('/',$album);
$album_name = $e[count($e)-1];
$album_name = str_replace('_',' ',$album_name); // remove periods. SECURITY
// in PHP we'll create the pictures array.
// Print directory
function fileexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
function print_js_array($name,$array)
{
echo "var ".$name." = new Array(";
$first = true;
foreach ($array as $item) {
if ($first) {$first = false;} else {echo ',';}
echo "'$item'";
}
echo ");\n" ;
}
$dir = 'image-cache'.$album;
$handle = @opendir($dir);
$pictures = array();
$titles = array();
if ($handle) {
while(false !== ($readdir = readdir($handle))){
if (fileexts($readdir) == 'jpg' && strstr($readdir,'disp640')) {// display only 640 thumbs
array_push($pictures,$readdir);
array_push($titles,str_replace('_disp640.jpg','',$readdir));
}
}
closedir($handle);
} else {
echo "ERROR: Bad album name, either obsolete, it changed name or there is another error. Go back." ;
exit(0);
}
// CHANGE THIS IF IDS MOVES
$albumurl = '/ids/index.cgi?mode=album&album=' . $_GET['album'];
?>
Caching SlideShow
|
Prev | Next |