// Parse URL //
$qstring = $_SERVER[QUERY_STRING];
$str = explode("?",($qstring));
$str2 = explode("&",$str[0]);
for ($i=0;$i < count($str2);$i++) {
if (preg_match('/text=/', $str2[$i])) {
$text = urldecode(substr($str2[$i],5,strlen($str2[$i])));
$card_text = urldecode(substr($str2[$i],5,strlen($str2[$i])));
}
if (preg_match('/image=/', $str2[$i])) {
$image = substr($str2[$i],6,strlen($str2[$i]));
}
if (preg_match('/archive=/', $str2[$i])) {
$archive = substr($str2[$i],8,strlen($str2[$i]));
}
}
// PATHS //
$archivesPath = "_archives";
$allarchives = array();
$allfiles = array();
$filenames = array();
$filePaths = array();
$fileLPaths = array();
$fileSPaths = array();
$archives = array();
// YEAR //
if (is_dir($archivesPath)) {
$handle = opendir($archivesPath);
$years = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "temp") {
array_push($years,$file);
}
}
closedir($handle);
rsort($years);
$ycount = count($years);
}
// ARCHIVES //
$i=0;
while($i < $ycount) {
if (is_dir("$archivesPath/$years[$i]")) {
$handle = opendir("$archivesPath/$years[$i]");
$archivenames = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
array_push($archives,$file);
if($file == $archive) {
array_push($archivenames,$file);
}
}
}
$acount = count($archivenames);
if($archivenames) {
$allarchives = array_merge($allarchives,$archivenames);
} else {
$allarchives = array_merge($allarchives,$archives);
}
if($archive == "") { $archive = $archivenames[0]; }
$i++;
}
closedir($handle);
rsort($archives);
rsort($allarchives);
$acount = count($allarchives);
}
// FILES //
$i=0;
while($i < $acount) {
$arch = $allarchives[$i];
$archiveyr = substr($arch,0,4);
$archivePath = "$archivesPath/$archiveyr/$arch";
if (is_dir("$archivePath")) {
$handle = opendir("$archivePath");
$files = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && preg_match('/.jpg/',$file)) {
array_push($files,"$file");
array_push($archives,"$arch");
array_push($filePaths,"$archivePath/$file");
}
}
closedir($handle);
$fcount = count($files);
rsort($files);
$allfiles = array_merge($allfiles,$files);
$i++;
}
rsort($archives);
rsort($filePaths);
rsort($allfiles);
}
// }
// BUILD A TABLE OF IMAGES //
$i = 0;
$cols = 5;
$rows = 50;
$total = ($cols*$rows);
$tdcount++;
$count = count($allfiles);
$pages = ceil($count/$total);
if($start == "") { $start = 0; }
if($end == "") { $end = ($start+$total); }
if($end >= $count) { $end = ($count); }
$nextbatch = ($end);
if($nextbatch == $count) { $nextbatch = (0); }
$prevbatch = ($start-$total);
if($prevbatch <= 0) { $prevbatch = (0); }
$pageNo = ceil((($start)/$total)+1);
if($pageNo == 0) { $pageNo = ($count/$total); }
echo "";
/* echo "
"; */
/* echo "
Files: ".($start+1)."-".$end." of ".count($allfiles).""; */
/* */
/* echo("
![](_images/previmg.gif)
"); */
/* */
/* while($a < $pages) { */
/* if($a == ($pageNo-1)) { */
/* $page_display .= "
".($a+1)." "; */
/* } else { */
/* $page_display .= "
".($a+1)." "; */
/* } */
/* $a++; */
/* } */
/* echo $page_display; */
/* echo("![](_images/nextimg.gif)
"); */
echo "
";
echo "
\n";
echo "";
echo "<< Home ";
include("list_archives.php");
echo " |
\n";
$i = $start;
while ($i < $end) {
$newRow = (is_integer($tdcount/($cols)));
if ($newRow) {
echo "";
} else {
echo " | ";
}
if (is_file("$fileSPaths[$i]")) {
$imagesize = getimagesize("$fileSPaths[$i]");
$img_width = $imagesize[0];
$img_height = $imagesize[1];
}
if (is_file("$fileLPaths[$i]")) {
$imageLsize = getimagesize("$fileLPaths[$i]");
$img_Lwidth = $imageLsize[0];
$img_Lheight = $imageLsize[1];
}
echo "";
if ($newRow) {
echo " | \n
\n";
} else {
echo "\n";
}
$tdcount++;
$i++;
}
echo "
";
/* echo "
Files: ".($start+1)."-".$end." of ".count($allfiles).""; */
/* echo("
![](_images/previmg.gif)
"); */
/* echo $page_display; */
/* echo("
![](_images/nextimg.gif)
"); */
?>