]> git.defcon.no Git - plsgen/blobdiff - index.php
Four new features, two bugfixes. Version 0.2 code.
[plsgen] / index.php
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..4377154
--- /dev/null
+++ b/index.php
@@ -0,0 +1,79 @@
+<html>
+<head><title>plsgen-generated photoalbum.</title>
+
+<link rel='stylesheet' href='indexstyle.css' type='text/css' /> 
+
+</head>
+<body>
+<div id="wrapper">
+<div id="head">
+<h1>Photo albums!</h1>
+<a style="display: block; float: right;" href="rss.php"><img src="images/rss_icon.png" alt="RSS" border="0" /></a>
+<div id="head-link"><a href="http://example.com">Update index.php!</a>
+</div>
+</div>
+<div id="content">
+
+<?php 
+
+//define the path as relative
+$path = "./";
+
+//using the opendir function
+$dir_handle = @opendir($path) or die("Unable to open $path");
+   
+//running the while loop
+while ($file = readdir($dir_handle)) {
+       $target = $path . $file;
+       if (($file != "images") && ($file != "generate") &&  ($file != ".") && ($file != "..")) {
+               if(file_exists($target)) {
+                       if (!is_file($target)) {
+                               if (is_file($target . "/.title")) {
+                                       $fd = fopen($target . "/.title", "r");
+                                       $buf = "";
+                                       $buf = fgets($fd, 4096);
+                                       fclose($fd);
+                                       $album[$file] = "<span class='strong'>" . $buf . "</span>";
+                               }
+
+                               if (is_file($target . "/.indeximage")) {
+                                       $fd = fopen($target . "/.indeximage", "r");
+                                       $buf =  $file . "/thumb/";
+                                       $buf .= fgets($fd, 4096);
+                                       chop ($buf);    
+                                       fclose($fd);
+                                       $idximage[$file] = "<img src='" . $buf . "' alt='Thumb' />";
+                               }
+
+                       } else {
+
+                       }
+               }   
+       }
+}
+//closing the directory
+closedir($dir_handle);
+
+krsort($album);
+
+foreach ( $album as $key => $value ) {
+       echo "<div class='album'>";
+       echo "<div class='idxthumb'>";
+       echo "<a target=_blank href='" . $key . "'>";
+       echo $idximage[$key];
+       echo "</a>";
+       echo "</div>";
+       echo "<div class='idxlink'>";
+       echo "<a target=_blank href='" . $key . "'>" . $key . "</a>\n";
+       echo "</div>";
+       echo "<div class='title'>$value</div>";
+       echo "</div>";
+}
+?>
+</div>
+</div>
+<div style="font-family: sans; font-size: 7pt; color: #444; margin-top: 20px;">
+Photo gallery index by Jon Langseth, generated using <a href="index.phps">index.php</a>
+</div>
+</body>
+</html>