diff options
author | Arun Persaud <arun@nubati.net> | 2011-11-24 20:41:53 -0800 |
---|---|---|
committer | Arun Persaud <apersaud@lbl.gov> | 2011-11-24 20:41:53 -0800 |
commit | 9d77827195a8057746842bfa307d550d04ed02f9 (patch) | |
tree | f40a8c56efd63731daf6f0a257648b5812858d68 | |
parent | 43a2a8bb13aee236c444eafafd57d67357f9c234 (diff) | |
download | photo-tags-9d77827195a8057746842bfa307d550d04ed02f9.tar.gz photo-tags-9d77827195a8057746842bfa307d550d04ed02f9.tar.bz2 photo-tags-9d77827195a8057746842bfa307d550d04ed02f9.zip |
added a permalink and use clean urls
this needs .htaccess. Already added clean urls for tags and single pic, but at the moment only page is working.
-rw-r--r-- | .htaccess_template | 24 | ||||
-rw-r--r-- | README | 14 | ||||
-rw-r--r-- | index.php | 10 | ||||
-rw-r--r-- | style.css | 8 |
4 files changed, 49 insertions, 7 deletions
diff --git a/.htaccess_template b/.htaccess_template new file mode 100644 index 0000000..203ba4c --- /dev/null +++ b/.htaccess_template @@ -0,0 +1,24 @@ +<IfModule mod_rewrite.c> +RewriteEngine on + +RewriteBase /<insert web base url here> + + +# make the url nice and clean; the comments shows an url that should be matched + +# web_base/tag/me+berlin/pic/id +RewriteRule tag/([-_a-zA-Z0-9+]*)/pic/([0-9]*) index.php?tag=$1&pic=$2 [L] + +# web_base/tag/tag1+tag2/page/4 +RewriteRule tag/([-_a-zA-Z0-9+]*)/page/([0-9]*) index.php?tag=$1&page=$2 [L] + +# web_base/tag/tag1+tag2 +RewriteRule tag/([-_a-zA-Z0-9+]*) index.php?tag=$1 [L] + +# web_base/pic/17 +RewriteRule pic/([0-9]*) index.php?pic=$1 [L] + +# web_base/page/4 +RewriteRule page/([0-9]*) index.php?page=$1 [L] + +</IfModule> @@ -1,7 +1,8 @@ This are some simple php files and bash scripts to display your F-spot -photos including information from the data-base on a webpage. +photos including information from the data-base on a webpage. To get +up and running follow these steps: -You can exclude/include certain tags incase you want for example on +1) You can exclude/include certain tags incase you want for example on show pictures on the web that were tagged "Public". To use the scripts copy config.ini_template to config.ini, edit it and @@ -10,7 +11,9 @@ then run for example f-spot-db-reduce.sh --include='Public' This will create a new smaller database that only contains information -about pictures with the Public tag. Next run +about pictures with the Public tag. + +2) Next run ./create_thumbnails.sh @@ -20,7 +23,10 @@ will need to run it several times. This is done, so that you limit the time this tasks run, so that it doesn't get shut down on for example rented web-space where execcive CPU uses is an issue. -Ones this is done you can visit index.php and everything should be working. +3) install .htaccess + +edit the "RewriteBase" in the .htaccess_template file and rename it to .htaccess. +Onces this is done you can visit index.php and everything should be working. Feel free to fork, send in patches, make suggestions. @@ -17,9 +17,9 @@ else ?> <html> <title><?php echo htmlspecialchars($title) ?></title> -<script src="d3.min.js"></script> -<link rel="stylesheet" type="text/css" href="normalize.css" /> -<link rel="stylesheet" type="text/css" href="style.css" /> +<script src="<?php echo $webbase?>/d3.min.js"></script> +<link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/normalize.css" /> +<link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/style.css" /> <body> @@ -29,6 +29,8 @@ else <button class="prev" disabled="disabled" onclick="left()"> prev </button> <button class="next" onclick="right()">next </button> +<div class="permalink"></div> + <div class="pics"> </div> <footer> @@ -68,6 +70,8 @@ function myreload(a) { checkbutton(); }); + permalink="<?php echo $webbase ?>/page/"+page; + d3.select(".permalink").html("Permalink: <a href=\""+permalink+"\">"+permalink+"</a>"); d3.select(".debug").text("P, count= "+a+" "+count); } @@ -2,6 +2,14 @@ h1 {color:red} body {background-color: black} +.permalink { + float:right; + color: #eee; + padding-right: 1em; +} + +a[visited]{ color: #aaa;} + .pics li { display: inline; list-style: none; |