From 4023001a68b3d85891ab744eb77e7b22a9dd8e3f Mon Sep 17 00:00:00 2001 From: jimmacfx Date: Fri, 25 Nov 2005 22:16:10 +0000 Subject: import original 0.11 git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@2 4fa712ea-3c06-0410-9261-c11b4c06c003 --- www/index.php | 284 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 www/index.php (limited to 'www/index.php') diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..0ef7bc8 --- /dev/null +++ b/www/index.php @@ -0,0 +1,284 @@ +header("Photos"); +require("inc/header.inc.php"); + +// folder > tree +echo "
Photo Gallery Index"; + +######################################### +# Overall Gallery Index # +######################################### +if (!$galerie) { + # finish off navigation bar + echo "
\n\n"; + /* + - nacti adresare + - setrid podle casu + - pro kazdy rok + - setrid podle mesice + - vypis + */ +# TODO: Make date file support date of the month +# And add info to README about date files + while ($file = $adr->Read()) { + // checking for inc is only really needed when gallery_dir == $root + // hopefully not many galleries will be named inc ;) + if (is_dir("$gallery_dir/$file") && !ereg("\.", $file) && $file!="inc") { + // Use date file for gallery date if avaliable + $datefile = "$root/$gallery_dir/$file/date.txt"; + if (file_exists($datefile)) { + $date_array = file($datefile); + $year=trim($date_array[2]); + $month=trim($date_array[1]); + $galerieyear["$file"]=$year; + $galeriemonth["$file"]=$month; + } else { // Get Dates from modification times + $mtime = filemtime("$gallery_dir/$file"); + $galerieyear["$file"] = date("Y", $mtime); + $galeriemonth["$file"] = date("F", $mtime); + } + } + } + + // re-sort array in order of months - so that they will be printed in order + $months = array("December", "November", "October", "September", "August", "July", "June", "May", "April", "March", "February", "January"); + for ($i = 2010; $i >= 1990; $i--) { + foreach ($months as $thismonth) { + foreach ($galeriemonth as $foldername => $month) { + if (strcasecmp($month, $thismonth) == 0) { + if ($galerieyear["$foldername"] == $i) { + $galerieyearordered["$foldername"]=$galerieyear["$foldername"]; + $galeriemonthordered["$foldername"]=$galeriemonth["$foldername"]; + } + } + } + } + } + + foreach ($galerieyearordered as $file => $mtime) { + $year=$galerieyearordered["$file"]; + $month=$galeriemonthordered["$file"]; + if ($thisyear!=$year) { #if the year is not equal to the current year + #This is the first year + if ($thisyear) { echo " \n\n";}// end last year if this is + // not the first one + #This is a new year + unset($thismonth); + echo "

$year

\n"; + echo ""; + } + # now months + if ($thismonth!=$month) { + #first one + if ($thismonth) { echo "
\n"; } // end of last month if + // this is not the first one + #new month + echo "

$month

\n"; + } + + echo "

$file

\n"; + $thisyear=$year; + $thismonth=$month; + } + echo "
\n\n\n"; + +############################## +# Individual Gallery Index # +############################## +} elseif (!$snimek) { + # finish off navigation header + echo "\n > $galerie\n\n

\n"; + //thumbnails + $path = "$gallery_dir/$galerie/thumbs"; + $obrazky = new SortDir($path); + check($galerie); // check for nasty input + while ($file = $obrazky->read()) { + if (is_file("$path/$file") && eregi("^img-([0-9]+)\.(png|jpg)", $file, $x)) { + $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}"; + $velikost = getimagesize("$root/$thumb"); + echo " "; + echo "90) { + echo $velikost[3]; + } else { + echo "width=\""; + $scaled = round($velikost[0] / 1.5); + echo $scaled; + echo "\" height=\"${velikost[0]}\""; + } + } + echo " src=\"$thumb\" "; + echo "alt=\"photo No. ${x[1]}\" />"; + echo "\n"; + } + } + echo "

\n"; + //and links to archived images: + echo "\n

\n"; + if (file_exists("$gallery_dir/$galerie/zip/mq.zip")) { + echo "[ zipped MQ images ] "; + } + if (file_exists("$gallery_dir/$galerie/zip/mq.tar.bz2")) { + echo "[ MQ images tarball ] "; + } + if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) { + echo "[ zipped HQ images ]"; + } + if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) { + echo "[ HQ images tarball ]"; + } + echo "

"; + +################################# +# Individual Image # +################################# +} else { //low-res image + # finish off header + echo "\n > $galerie\n > Photo"; + echo " $snimek"; + $path = "$gallery_dir/$galerie/thumbs"; + $obrazky = new SortDir("$path"); + check($galerie); + $path = "$gallery_dir/$galerie/lq"; + $file = "$path/img-$snimek.jpg"; + if (!file_exists($file)) { + echo "No such image"; + $page->footer(); + exit; + } + $velikost = getimagesize("$root/$file"); + /* + navigation($galerie, $snimek, null); + */ + + // mini thumbnail roll + + if ($show_thumbs) { + echo "\n\n
"; + echo ""; + echo "\n"; + echo " : \n"; + while ($thumbfile = $obrazky->read()) { + if ( eregi("^img-([0-9]+)\.(png|jpg)", + $thumbfile, $x)) { + $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}"; + echo " "; + echo ""; + echo " \n"; + } + } + if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) { + echo ""; + echo "zip"; + } + if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) { + echo ""; + echo "zip"; + } + echo "
\n"; + } else { + // show the popup button + echo "\n\n
"; + echo ""; + echo "\n"; + echo "
\n"; + } + + /* main image + thumbnail navigation (prev/next) */ + + $divheight = $velikost[1] + 10; + echo "
\n"; // extra kludge + // because of tall + // images + + echo "\"$snimek\"\n"; + navigation($galerie, $snimek, "prev"); + navigation($galerie, $snimek, "next"); + echo "
\n"; //image + + + if ($exif_prog) require("$root/inc/exif.inc.php"); // FIXME: prettify + $comment = "$root/$gallery_dir/$galerie/comments/$snimek.txt"; + if (file_exists($comment)) { + $cmnt_array = file($comment); + while ($x = current($cmnt_array)) { + eregi("^ *(.*) *", $x, $y); + $cmnt .= $y[1]; + next($cmnt_array); + } + /* php4 only + foreach ($cmnt_array as $x) { + $cmnt .= $x; + } + */ + echo "
$cmnt
"; + } + echo "
"; + if (file_exists("$gallery_dir/$galerie/mq/img-$snimek.jpg")) { + echo "MQ "; + } + if (file_exists("$gallery_dir/$galerie/hq/img-$snimek.jpg")) { + echo "HQ"; + } + echo "
\n"; //mqhq + + navigation($galerie, $snimek, null); +} + +require("inc/footer.inc.php"); +$page->footer(); +?> -- cgit v1.2.3