$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; global $sitehome; global $ExeName; if ($sitehome != '') print "Home -> \n"; if ($path == '') { print "Albums\n"; return; } print "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) { $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) { $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; global $display_cols; global $thumb_size; $CurrentDir = $pix_base . "/" . $album; $alblist = GetDirList($CurrentDir); if (count($alblist) == 0) return; # no sub-albums is_array($dirlist) and sort($dirlist); 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 ""; print "
\n"; } else { print ""; print "
"; } 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 $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 " "; print "

Pictures in this album:

\n"; print ""; for ($x = $start ; $x < $start + $items_per_page and $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].jpg&size=$thumb_size"; $imgsrc = preg_replace('/ /', "%20", "$thumbpic"); print ""; # print "
$file\n"; print "
$file\n"; print "

\n"; DisplayComment("$parts[1].jpg", $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"; if ($album == "") $mode = "album"; if ($mode == "") $mode = "home"; if ($mode == "album" or $mode == "view") print "PicAlbum: $album\n"; else print "PicAlbum: List of Albums\n"; print "\n"; print "\n"; print "
\n"; preg_match("/(.*\/).*$/",$SCRIPT_FILENAME,$matches); $realbase = $matches[1] . $pix_base; if ($dispsize == '') $dispsize = $default_size; if ($start == '') $start = 0; 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 = "$realbase/$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].jpg&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 ""; print "
\n"; DisplayComment($pic); print "
\n"; DisplayDate("$parts[1].jpg"); print "
\n"; } print "\n"; print "\n"; print ""; ############ print "\n"; } $totalfiles = sizeof($filelist); print "
\n"; if ($filelist[($picindex-1)] != '') { $prevfile = $filelist[($picindex-1)]; preg_match("/(.*)\.jpg/i",$prevfile,$parts); $thumbpic = "displaypic.php?source=$pix_base/$album/$parts[1].jpg&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 ($filelist[($picindex+1)] != '') { $nextfile = $filelist[($picindex+1)]; preg_match("/(.*)\.jpg/i",$nextfile,$parts); $thumbpic = "displaypic.php?source=$pix_base/$album/$parts[1].jpg&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(); ?>