summaryrefslogtreecommitdiff
path: root/pages/gallery.php
blob: cf7e052fc7228016be2ab80f19d4ea7954a7c355 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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";
   }
}
}
?>