summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-07-27 20:47:12 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-07-27 20:47:12 +0000
commit8335cc388672614395481d8519276e746fad3248 (patch)
tree5bd7dbb2f2498e255fb1f2d9c7e0a512a8ce401a
parente4b87dc58c86e1a03fa4a3529e060cb5e193030d (diff)
Fixes a bug where images more than one level deep in nested albums weren't displayed.
-rw-r--r--helpers/randimg.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/helpers/randimg.php b/helpers/randimg.php
index a9a5380..acc7b8d 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, i1.slug AS imgslug, i2.slug
+ SELECT i1.name, i1.title, i1.description, i1.relative_path_cache, i1.relative_url_cache, 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,10 +32,8 @@ 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->imgpath = $result->relative_path_cache;
+ $randimg->linkpath = $result->relative_url_cache;
$randimg->img_title = $result->title;
return $randimg;