summaryrefslogtreecommitdiff
path: root/pages/gallery.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/gallery.php')
-rw-r--r--pages/gallery.php135
1 files changed, 135 insertions, 0 deletions
diff --git a/pages/gallery.php b/pages/gallery.php
new file mode 100644
index 0000000..cf7e052
--- /dev/null
+++ b/pages/gallery.php
@@ -0,0 +1,135 @@
+<div class="header">
+ <div class="header_gallery">
+ <div class="header_text">Gallery</div>
+ </div>
+</div>
+<?php
+include_once($UTIL_DIR."/thumbnail.php");
+include_once($UTIL_DIR."/album.php");
+
+$width = 100;
+$height = 75;
+
+/*************
+ Select album
+*************/
+if($album == "") {
+ // echo "Select the group of images you want to see...\n";
+
+ $handle = opendir($ALBUMS_DIR . "/");
+ $albumdirs = array();
+ while($albumdir = readdir($handle)) {
+ array_push($albumdirs, $albumdir);
+ }
+
+ rsort($albumdirs);
+
+ foreach($albumdirs as $albumdir) {
+ if(!strstr($albumdir, ".") && !strstr($albumdir, "..")) {
+ $album = new Album($albumdir);
+ echo " <div class=\"album\">\n";
+ echo " <div class=\"icon\">\n";
+ echo " <a href=\"?page=gallery&amp;album=" . $album->album . "\">\n";
+ echo " <img alt=\"" . $album->title . "\" src=\"" .
+ thumbnail($albumdir, $album->icon, 100, 75) . "\"/>\n";
+ echo " </a>\n";
+ echo " </div>\n";
+ echo " <div class=\"title\">" . $album->title . "</div>\n";
+ echo " </div>\n";
+ }
+ }
+
+ echo "<div class=\"foot\">Select the group of images you want to see.</div>\n";
+}
+
+/*************
+ View photo
+*************/
+else {
+ function image($album, $file) {
+ global $ALBUMS_DIR;
+ echo $ALBUMS_DIR . "/" . $album . "/" . $file;
+ }
+
+ if($album) {
+ $a = new Album($album);
+
+ if($image) {
+ $photo = new Photo("", "");
+ $prev = "";
+ $next = "";
+
+ foreach($a->photos as $p) {
+ if($image == $p->file) {
+ $photo = $p;
+ }
+ if($image == $last->file) {
+ $next = $p;
+ break;
+ }
+ $prev = $last;
+ $last = $p;
+ }
+?>
+<div class="gallery">
+ <div class="gallery_album_title">Album: <?php echo $a->title; ?></div>
+ <div class="gallery_copyright">Copyright: <?php echo $a->copyright; ?></div>
+ <div class="gallery_photo">
+ <img alt="<?php echo $photo->text ?>" src="<?php image($album, $photo->file); ?>"/>
+ </div>
+ <div class="gallery_photo_title"><?php echo $photo->text; ?></div>
+ <div class="gallery_buttons">
+<?php if($prev) { ?>
+ <div class="gallery_button">
+ <a href="?page=gallery&amp;image=<?php echo $prev->file ?>&amp;album=<?php echo $album ?>" >
+ <img alt="prev" src="<?php echo thumbnail($album, $prev->file, $width, $height); ?>"/>
+ </a>
+ </div>
+<?php } else { ?>
+ <div class="gallery_button">
+ <img alt="stop" src="gfx/stop.png"/>
+ </div>
+<?php } ?>
+ <div class="gallery_button">
+ <a href="?page=gallery&amp;album=<?php echo $album ?>" >
+ <img alt="home" src="gfx/home.png"/>
+ </a>
+ </div>
+<?php if($next) { ?>
+ <div class="gallery_button">
+ <a href="?page=gallery&amp;image=<?php echo $next->file; ?>&amp;album=<?php echo $album ?>" >
+ <img alt="next" src="<?php echo thumbnail($album, $next->file, $width, $height); ?>"/>
+ </a>
+ </div>
+<?php } else { ?>
+ <div class="gallery_button">
+ <img alt="stop" src="gfx/stop.png"/>
+ </div>
+<?php } ?>
+ </div>
+</div>
+<?php
+ } else {
+/*************
+ Show album
+*************/
+
+// echo "<div class=\"headline\">" . $a->title . "</div>\n";
+ echo "<div class=\"gallery\">\n";
+ foreach($a->photos as $photo) {
+?>
+ <div class="gallery_image">
+ <a href="?page=gallery&amp;image=<?php echo $photo->file ?>&amp;album=<?php echo $album ?>">
+ <img alt="<?php echo $photo->file; ?>" src="<?php echo thumbnail($album, $photo->file, 100, 75); ?>"/>
+ </a>
+ </div>
+<?php
+ }
+ echo "</div>\n";
+ echo "<div class=\"foot\">". $a->title . "</div>\n";
+ }
+}
+}
+?>
+
+