summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-03-19 23:47:23 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-03-19 23:47:23 +0000
commite4b87dc58c86e1a03fa4a3529e060cb5e193030d (patch)
treed487a44bf69e11026ea8fb4457febb6dd025047e
parent79f4038d0e05c57082e841ac36fc2559dd70ea77 (diff)
Apparently some new changes in Gallery3 broke this module. This change defines a diff between the src of an img and the link address to the image itself.
-rw-r--r--helpers/randimg.php4
-rw-r--r--views/randimg.html.php2
2 files changed, 4 insertions, 2 deletions
diff --git a/helpers/randimg.php b/helpers/randimg.php
index 2310271..a9a5380 100644
--- a/helpers/randimg.php
+++ b/helpers/randimg.php
@@ -22,7 +22,7 @@ class randimg_Core {
$db = Database::instance();
$table_prefix = $db->table_prefix;
$query = "
- SELECT i1.name, i1.title, i1.description, i2.slug
+ SELECT i1.name, i1.title, i1.description, i1.slug AS imgslug, i2.slug
FROM {$table_prefix}items i1 JOIN {$table_prefix}items i2
ON i1.parent_id = i2.id
WHERE i1.type != 'album'
@@ -32,8 +32,10 @@ class randimg_Core {
$result = $db->query($query)->current();
$randimg = new View("randimg.html");
+ $linkpath = "$result->slug/$result->imgslug";
$relpath = "$result->slug/$result->name";
$randimg->imgpath = $relpath;
+ $randimg->linkpath = $linkpath;
$randimg->img_title = $result->title;
return $randimg;
diff --git a/views/randimg.html.php b/views/randimg.html.php
index 6cf0943..52d4d78 100644
--- a/views/randimg.html.php
+++ b/views/randimg.html.php
@@ -12,7 +12,7 @@ $virtpath = $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']);
$g3path = "{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}";
echo <<<HTML
-<a href="http://$g3path/$imgpath" title="$img_title">
+<a href="http://$g3path/$linkpath" title="$img_title">
<img src="http://$virtpath/var/resizes/$imgpath" style="border: thin solid black;" alt="$img_title" />
</a>