summaryrefslogtreecommitdiff
path: root/views/randimg.html.php
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2009-12-05 17:09:44 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2009-12-05 17:09:44 +0000
commit02ad78baae7e66c6c3bb6b5a2a4fc28a15e370c4 (patch)
tree1be3bac1922334a3d95f74474215fa66189cf724 /views/randimg.html.php
parent934c6efcf6235f65994a143b7baf0616a5cb123c (diff)
View no longer has URLs hardcoded, but uses environment to construct site-specific URLs.
Diffstat (limited to 'views/randimg.html.php')
-rw-r--r--views/randimg.html.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/views/randimg.html.php b/views/randimg.html.php
index f3ae4bf..6cf0943 100644
--- a/views/randimg.html.php
+++ b/views/randimg.html.php
@@ -1,2 +1,21 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<?php echo "<a href='http://natha.nkinka.de/photos/index.php/$imgpath' title='$img_title'><img src='http://natha.nkinka.de/photos/var/resizes/$imgpath' style='border: thin solid black;' alt='$img_title' /></a>"; ?>
+<?php
+
+/**
+ * In some cases the proper URL path to the images on the disc
+ * will be virtualized via an Apache Alias definition, so grab
+ * that path here.
+ */
+$virtpath = $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']);
+
+// URL to Gallery3
+$g3path = "{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}";
+
+echo <<<HTML
+<a href="http://$g3path/$imgpath" title="$img_title">
+ <img src="http://$virtpath/var/resizes/$imgpath" style="border: thin solid black;" alt="$img_title" />
+</a>
+
+HTML;
+
+?>