$DescriptionChars) print "..."; } function DisplayDate($File) { global $album; $PicFile = "albums/$album/$File"; exec("./jhead -date \"$PicFile\"", $OutputArray); $OutputString = implode($OutputArray, " "); if (strlen($OutputString) > 0) print "Picture date/time: $OutputString"; } function DisplayNavBar($mode,$path,$start) { $endpoint = basename($path); global $pix_base; global $realbase; global $dispsize, $default_size; global $sitehome; global $ExeName; if ($sitehome != '') print "Home -> \n"; if ($path == '') { print "Albums\n"; return; } echo "Albums\n"; $doo = split("/",$path); $prepath = ''; while (list($foo,$filename) = each($doo)) { if ($prepath) $fullname = $prepath . "/" . $filename; else $fullname = $filename; if ($filename == $endpoint) print " -> $filename\n"; else { print " -> $filename\n"; } $prepath = $fullname; } # print "split up *" . $path . "*"; } function GetFileList($Directory) { $filelist = array(); $handle = opendir($Directory); while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and $file != ".htaccess" and $file != ".htpasswd" and $file != ".htgroup" and $file != ".album.jpg" ) { $filelist[] = $file; } } return $filelist; } function GetDirList($Directory) { $dirlist = array(); $handle = opendir($Directory); while (($file = readdir($handle)) != '') { if (is_dir($Directory . "/" . $file) and $file != "." and $file != "..") { $dirlist[] = $file; } } return $dirlist; } function DisplayAlbumList($album="") { global $pix_base; global $ExeName; global $dispsize, $default_size; global $display_cols; global $thumb_size; $CurrentDir = $pix_base . "/" . $album; $alblist = GetDirList($CurrentDir); if (count($alblist) == 0) return; # no sub-albums is_array($alblist) and sort($alblist); print "\n"; if ($display_cols > 1) print " "; else print " "; print "

Albums:

\n"; is_array($alblist) and sort($alblist); for ($i = 0 ; $i < sizeof($alblist) ; $i++) { # $NewAlbum = $album . "/" . $alblist[$i]; if ($album != '') $NewAlbum = $album . "/" . $alblist[$i]; else $NewAlbum = $alblist[$i]; $AlbumPictureFile = "$pix_base/$album/$alblist[$i]/.album.jpg"; $AlbumFile = "$pix_base/$album/$alblist[$i]/.album"; print "\n"; if (file_exists($AlbumPictureFile)) { print ""; print ""; echo "
\n"; } else { echo ""; echo "
"; } print "$alblist[$i]\n"; if ($display_cols > 2) print " "; else print ""; if (file_exists($AlbumFile)) readfile($AlbumFile); // else print "$AlbumFile"; print "
\n"; print ""; } } function DisplayThumbnails($album="", $start=0) { global $ExeName; global $pix_base; global $realbase; global $items_per_page; # global $thumbsize; global $thumb_size; global $display_cols; global $dispsize; global $default_size; global $DescriptionChars; $filelist = GetFileList("$pix_base/$album"); is_array($filelist) and sort($filelist); $totalfiles = sizeof($filelist); if ($totalfiles == 0) return; # no files $colcounter = 0; print ""; if ($display_cols > 1) print " "; else print " "; $album_file = "$pix_base/$album/.album"; if (file_exists($album_file)) { readfile($album_file); echo "
\n"; } print "

Pictures in this album:

\n"; print ""; for ($x = $start ; $x < $start + $items_per_page and isset($filelist[$x]) ; $x++) { $file = $filelist[$x]; if ($colcounter == $display_cols) { print "\n"; $colcounter = 0; } if (is_dir($realbase . "/$album/" . $file)) { print ""; print "$file\n"; print "\n"; $colcounter++; } else if (preg_match("/.*\.jpg/i",$file)) { preg_match("/(.*\.jpg)/i",$file,$parts); $thumbpic = "displaypic.php?source=$pix_base/$album/$parts[1]&size=$thumb_size"; $imgsrc = preg_replace('/ /', "%20", "$thumbpic"); print ""; # print "
$file\n"; print "
$file\n"; print "

\n"; DisplayComment("$parts[1]", $DescriptionChars); print "\n"; $colcounter++; } } if ($totalfiles != 0) { # here we fill in the rest for ($i = 0 ; $i < ($display_cols - $colcounter) ; $i++) { print "\n"; } print "\n"; print "
"; if ($start != 0) print "Start | "; if ($start > 0) { print "Prev $items_per_page | "; } if ($totalfiles > $start + $items_per_page) print "Next $items_per_page | "; print ""; if ($totalfiles > 0) print "Images " . ($start+1) . " to $x of $totalfiles
\n"; else print " "; } print "
"; } print "\n"; print "\n"; $album = GetVar('album', ""); $mode = GetVar('mode', 'home'); if ($album == "") $mode = "album"; if ($mode == "album" or $mode == "view") print "PicAlbum: $album\n"; else print "PicAlbum: List of Albums\n"; print "\n"; print "\n"; print "
\n"; $realbase = dirname($_SERVER{'SCRIPT_FILENAME'}); $pixbase = "$realbase/$pix_base"; $dispsize = GetVar('dispsize', $default_size); $start = GetVar('start', 0); $pic = GetVar('pic'); if ($mode == 'home' or $mode == '' or $mode == 'album') { print "\n"; print "
\n"; #print " \n"; #print " "; #print " \n"; set_time_limit(0); $colcounter = 0; $filelist = GetFileList("$pix_base/$album"); $dirlist = GetDirList("$pix_base/$album"); is_array($dirlist) and sort($dirlist); # is_array($filelist) and sort($filelist); $totalfiles = sizeof($filelist); # here we display the directories (sub-albums) DisplayAlbumList($album); DisplayThumbnails($album, $start); print "
"; DisplayNavBar("album", $album, $start); print "
\n"; } else if ($mode == 'view') { print "\n"; print "
\n"; #print " \n"; #print " "; #print " \n"; clearstatcache(); $sourcefile = "$pixbase/$album/$pic"; $dlinksize = $dispsize; $srcsize = getimagesize("$sourcefile"); if ($dispsize >= $srcsize[0]) { $dispsize = "Original"; } if ($dispsize == 'Original') { $viewpic = "albums/$album/$pic"; } else { preg_match("/(.*\.jpg)/i",$pic,$parts); $viewpic = "displaypic.php?source=$pix_base/$album/$parts[1]&size=$dispsize"; } print "\n"; print "\n"; print "
"; $handle=opendir("$pix_base/$album"); while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file)) { $filelist[] = $file; } } sort($filelist); $picindex = -1; for($i=0 ; $i
"; $imgsrc = preg_replace('/ /', "%20", "$viewpic"); print "

\n"; DisplayComment($pic); print "
\n"; # DisplayDate("$parts[1].jpg"); DisplayDate($pic); print "
\n"; print "\n"; } print "\n"; print "\n"; print ""; ############ print "\n"; } $totalfiles = sizeof($filelist); print "
\n"; if (isset($filelist[($picindex-1)]) && ($filelist[($picindex-1)] != '')) { $prevfile = $filelist[($picindex-1)]; preg_match("/(.*\.jpg)/i",$prevfile,$parts); $thumbpic = "displaypic.php?source=$pix_base/$album/$parts[1]&size=$thumb_size"; $imgsrc = preg_replace('/ /', "%20", "$thumbpic"); print "<-"; # print ""; print ""; print "
\n"; DisplayComment($prevfile, $DescriptionChars); } else { # print "
"; #print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print ""; print "
(Original Photo Size = $srcsize[0]x$srcsize[1])
\n"; #print "
\n"; if (isset($filelist[$picindex + 1]) && ($filelist[($picindex+1)] != '')) { $nextfile = $filelist[($picindex+1)]; preg_match("/(.*\.jpg)/i",$nextfile,$parts); $thumbpic = "displaypic.php?source=$pix_base/$album/$parts[1]&size=$thumb_size"; $imgsrc = preg_replace('/ /', "%20", "$thumbpic"); print ""; # print "->"; print "->"; print "
\n"; DisplayComment($nextfile, $DescriptionChars); } else { #print " \n"; print "
\n"; } print "Generated by PicAlbum $version by Frank Sorenson"; print "
\n"; print "\n"; print "\n"; #phpinfo(); ?>