\n"; print "
"; print ""; print "\n"; set_time_limit(0); $albumDir = $pix_base."/".$_GET['album']; $handle=opendir($albumDir); $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 . "/".$_GET['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; } $albumDirName = $_GET['album'] ."/".$dirname; print "\n"; $colcounter++; } for ($x = $_GET['start'] ; $x < $_GET['start']+$items_per_page and $filelist[$x] ; $x++) { $file = $filelist[$x]; if ($colcounter == $display_cols) { print "\n"; $colcounter = 0; } if (is_dir($realbase . "/".$_GET['album']."/" . $file)) { print "\n"; $colcounter++; } else if (preg_match("/.*\.jpg/i",$file)) { $sourcefile = $realbase."/".$_GET['album']."/".$file; preg_match("/(.*)\.jpg/i",$file,$parts); $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = $dynbase."/".$_GET['album']."/".$thumbpic; checkDir($dynbase."/".$_GET['album']); #if (!file_exists("$dynbase/$_GET['album']")) { #mkdir("$dynbase/$_GET['album']",0755); #} #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/".$dyn_base."/".$_GET['album']."/".$thumbpic); print "\n"; $colcounter++; } } for ($i = 0 ; $i < ($display_cols - $colcounter) ; $i++) { print "\n"; } print "\n"; print ""; } else if ($_GET['mode'] == 'view') { $handle=opendir($pix_base."/".$_GET['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."/".$_GET['album']."/".$_GET['pic']; $dlinksize = $_GET['dispsize']; $srcsize = GetImageSize("$sourcefile"); if ($_GET['dispsize'] >= $srcsize[0]) { $_GET['dispsize'] = "Original"; } if ($_GET['dispsize'] == 'Original') { $viewfile = $sourcefile; $viewpic = $_GET['pic']; $imgsrc = preg_replace('/ /',"%20","/".$pix_base."/".$_GET['album']."/".$viewpic); } else { preg_match("/(.*)\.jpg/i",$_GET['pic'],$parts); $viewpic = "$parts[1]__scaled_".$_GET['dispsize'].".jpg"; $viewfile = $dynbase."/".$_GET['album']."/".$viewpic; $imgsrc = preg_replace('/ /',"%20","/".$dyn_base."/".$_GET['album']."/".$viewpic); } #if (!file_exists($viewfile)) { createImage($_GET['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); //print_r($matches); $realbase = $matches[1] . $pix_base; //$dynbase = "/www/cybernode" . $matches[1] . $dyn_base; $dynbase = $matches[1] . $dyn_base; $imgbase = dirname($_SERVER['SCRIPT_NAME']); ($imgbase == '/') and $imgbase = ''; //print $realbase . "
"; //print $dynbase . "
"; //print $imgbase . "
"; //exit; if ($_GET['dispsize'] == '') $_GET['dispsize'] = $default_size; if ($_GET['start'] == '') $_GET['start'] = 0; if (preg_match("/\.\./",$_GET['pic']) or preg_match("/\.\./",$_GET['album'])) { print "Please refrain from trying to access unauthorized files in this manner.
"; print "Have a nice day."; } else if ($_GET['mode'] == 'home' or $_GET['mode'] == '') { print "

Picture Albums available on Cybernode:

\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 ($_GET['mode'] == 'album') { NavBar("album",$_GET['album'],$_GET['start']); print "
"; print "".$dirname."\n"; print "
"; print "".$file."\n"; print ""; print "
$file\n"; print "
"; print "Start | "; if ($_GET['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 " . ($_GET['start']+1) . " to $x of $totalfiles
\n"; } else { print " "; } print "
"; print ""; 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."/".$_GET['album']."/".$prevfile; preg_match("/(.*)\.jpg/i",$prevfile,$parts); checkDir($dynbase."/".$_GET['album']); #if (!file_exists("$dynbase/$_GET['album']")) { #mkdir("$dynbase/$_GET['album']",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = $dynbase."/".$_GET['album']."/".$thumbpic; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/".$dyn_base."/".$_GET['album']."/".$thumbpic); print ""; print "<-Prev
"; } else { print "
"; print "\n"; print "\n"; print ""; print "\n"; print "
Change image size:
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Original Photo Size = " . $srcsize[0] . "x" . $srcsize[1] . "
\n"; print "\n"; print "
\n"; if ($filelist[($picindex+1)] != '') { $nextfile = $filelist[($picindex+1)]; $sourcefile = $realbase."/".$_GET['album']."/".$nextfile; preg_match("/(.*)\.jpg/i",$nextfile,$parts); checkDir($dynbase."/".$_GET['album']); #if (!file_exists("$dynbase/$_GET['album']")) { #mkdir("$dynbase/$_GET['album']",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = $dynbase."/".$_GET['album']."/".$thumbpic; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/".$dyn_base."/".$_GET['album']."/".$thumbpic); print ""; print "Next ->
"; print "
"; } else { print "
\n"; print "

Original Code: PHPix $version
Heavily modified by Garth Gillespie for this site

\n"; print "\n"; pageBottom(); ?>