]> git.defcon.no Git - plsgen/blob - index.php
437715406b91be2d8b80e1d2d63919822c88909e
[plsgen] / index.php
1 <html>
2 <head><title>plsgen-generated photoalbum.</title>
3
4 <link rel='stylesheet' href='indexstyle.css' type='text/css' />
5
6 </head>
7 <body>
8 <div id="wrapper">
9 <div id="head">
10 <h1>Photo albums!</h1>
11 <a style="display: block; float: right;" href="rss.php"><img src="images/rss_icon.png" alt="RSS" border="0" /></a>
12 <div id="head-link"><a href="http://example.com">Update index.php!</a>
13 </div>
14 </div>
15 <div id="content">
16
17 <?php
18
19 //define the path as relative
20 $path = "./";
21
22 //using the opendir function
23 $dir_handle = @opendir($path) or die("Unable to open $path");
24
25 //running the while loop
26 while ($file = readdir($dir_handle)) {
27 $target = $path . $file;
28 if (($file != "images") && ($file != "generate") && ($file != ".") && ($file != "..")) {
29 if(file_exists($target)) {
30 if (!is_file($target)) {
31 if (is_file($target . "/.title")) {
32 $fd = fopen($target . "/.title", "r");
33 $buf = "";
34 $buf = fgets($fd, 4096);
35 fclose($fd);
36 $album[$file] = "<span class='strong'>" . $buf . "</span>";
37 }
38
39 if (is_file($target . "/.indeximage")) {
40 $fd = fopen($target . "/.indeximage", "r");
41 $buf = $file . "/thumb/";
42 $buf .= fgets($fd, 4096);
43 chop ($buf);
44 fclose($fd);
45 $idximage[$file] = "<img src='" . $buf . "' alt='Thumb' />";
46 }
47
48 } else {
49
50 }
51 }
52 }
53 }
54 //closing the directory
55 closedir($dir_handle);
56
57 krsort($album);
58
59 foreach ( $album as $key => $value ) {
60 echo "<div class='album'>";
61 echo "<div class='idxthumb'>";
62 echo "<a target=_blank href='" . $key . "'>";
63 echo $idximage[$key];
64 echo "</a>";
65 echo "</div>";
66 echo "<div class='idxlink'>";
67 echo "<a target=_blank href='" . $key . "'>" . $key . "</a>\n";
68 echo "</div>";
69 echo "<div class='title'>$value</div>";
70 echo "</div>";
71 }
72 ?>
73 </div>
74 </div>
75 <div style="font-family: sans; font-size: 7pt; color: #444; margin-top: 20px;">
76 Photo gallery index by Jon Langseth, generated using <a href="index.phps">index.php</a>
77 </div>
78 </body>
79 </html>