\n"; print "\n"; if ($mode == "album" or $mode == "view") { print "PHPix: $album\n"; } else { print "PHPix: List of Albums\n"; } print "\n"; /*print "\n";*/ print "\n"; include("../menu.php"); print "
\n"; print "
"; print ""; print "\n"; set_time_limit(0); $handle=opendir("$pix_base/$album"); $colcounter = 0; while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and !preg_match("/__scaled_/",$file) ) { $filelist[] = $file; } } rewinddir($handle); while (($file = readdir($handle)) != '') { if (is_dir($realbase . "/$album/" . $file) and $file != "." and $file != ".." ) { $dirlist[] = $file; } } is_array($dirlist) and sort($dirlist); is_array($filelist) and sort($filelist); $totalfiles = sizeof($filelist); print ""; for ($i = 0 ; $i < sizeof($dirlist) ; $i++) { $dirname = $dirlist[$i]; if ($colcounter == $display_cols) { print "\n"; $colcounter = 0; } print "\n"; $colcounter++; } 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 "\n"; $colcounter++; } else if (preg_match("/.*\.jpg/i",$file)) { $sourcefile = "$realbase/$album/$file"; preg_match("/(.*)\.jpg/i",$file,$parts); $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print "\n"; $colcounter++; } } for ($i = 0 ; $i < ($display_cols - $colcounter) ; $i++) { print "\n"; } print "\n"; print ""; } else if ($mode == 'view') { $handle=opendir("$pix_base/$album"); while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and !preg_match("/__scaled_/",$file) ) { $filelist[] = $file; } } sort($filelist); $picindex = -1; for($i=0 ; $i\n"; clearstatcache(); $sourcefile = "$realbase/$album/$pic"; $dlinksize = $dispsize; $srcsize = GetImageSize("$sourcefile"); if ($dispsize >= $srcsize[0]) { $dispsize = "Original"; } if ($dispsize == 'Original') { $viewfile = $sourcefile; $viewpic = $pic; $imgsrc = preg_replace('/ /',"%20","/$pix_base/$album/$viewpic"); } else { preg_match("/(.*)\.jpg/i",$pic,$parts); $viewpic = "$parts[1]__scaled_$dispsize.jpg"; $viewfile = "$dynbase/$album/$viewpic"; $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$viewpic"); } #if (!file_exists($viewfile)) { createImage($dispsize,$sourcefile,$viewfile); #} $viewsize = GetImageSize("$viewfile"); print ""; print "\n"; #if ($show_exif) { #$exif = read_exif_data($sourcefile); #while(list($k,$v)=each($exif)) { #echo "$k: $v
\n"; #} #} } print "
"; preg_match("/(.*\/).*$/",$_SERVER['SCRIPT_FILENAME'],$matches); $realbase = $matches[1] . $pix_base; $dynbase = $matches[1] . $dyn_base; $imgbase = dirname($_SERVER['SCRIPT_NAME']); ($imgbase == '/') and $imgbase = ''; if ($dispsize == '') $dispsize = $default_size; if ($start == '') $start = 0; /* mjd 2004-05-27 safety check $album and $pic */ $safechars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ /-."; $pic = str_strip($safechars, $pic); $album = str_strip($safechars, $album); if (preg_match("/\.\./",$pic) or preg_match("/\.\./",$album)) { print "Please refrain from trying to access unauthorized files in this manner.
"; print "Have a nice day."; } else if ($mode == 'home' or $mode == '') { print "

Albums:

\n"; $handle=opendir($pix_base); while (($file = readdir($handle)) != '') { if ($file != "." && $file != "..") { $alblist[] = $file; } } is_array($alblist) and sort($alblist); for ($i = 0 ; $i < sizeof($alblist) ; $i++) { print ""; print "$alblist[$i]\n"; print "
\n"; } closedir($handle); ## Album View (Thumbnails) } else if ($mode == 'album') { NavBar("album",$album,$start); print "
"; print "$dirname\n"; print "
"; print "$file\n"; print ""; print "
$file\n"; print "
"; print "Start | "; if ($start > 0) { print "Prev $items_per_page | "; } else { print "Prev $items_per_page | "; } if ($totalfiles > $x) { print "Next $items_per_page | "; } else { print "Next $items_per_page | "; } print ""; if ($totalfiles > 0) { print "Images " . ($start+1) . " to $x of $totalfiles
\n"; } else { print " "; } print "
"; print ""; print "
\n"; } print "\n"; print "\n"; print ""; ############ print "\n"; } $totalfiles = sizeof($filelist); #print "Charcoal\n"; #print " | Paint\n"; #print " | Shade\n"; #print "
\n"; print "
\n"; if ($filelist[($picindex-1)] != '') { $prevfile = $filelist[($picindex-1)]; $sourcefile = "$realbase/$album/$prevfile"; preg_match("/(.*)\.jpg/i",$prevfile,$parts); checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print ""; print "<-Prev
"; } 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)]; $sourcefile = "$realbase/$album/$nextfile"; preg_match("/(.*)\.jpg/i",$nextfile,$parts); checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print ""; print "Next ->
"; print "
"; } else { print "
\n"; print "Generated by PHPix $version"; print "
\n"; print "\n"; print "\n"; ?>