/* version history
0.1: first release
0.2: added titles array. cleaned up array creation in php
mobile version: fits into VGA screen.
*/
?>
SlideShow
//echo $_SERVER['HTTP_UA_PIXELS'];
?>
// 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();
// portrait 600
// landscape 592
// Look at HTTP_UA_PIXELS 640x480 or 480x640
$dim = '600';
if ($_GET['landscape'] || strstr($_SERVER['HTTP_UA_PIXELS'],'640x480')) {
// USE LANDSCAPE MODE
$dim = '592';
} else {
}
if ($handle) {
while(false !== ($readdir = readdir($handle))){
if (fileexts($readdir) == 'jpg' && strstr($readdir,'disp'.$dim)) {// display only 640 thumbs
array_push($pictures,$readdir);
array_push($titles,str_replace('_disp'.$dim.'.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'];
?>
Prev
echo ""; ?>
Next
// phpinfo()
?>