diff options
| -rw-r--r-- | helpers/randimg.php | 4 | ||||
| -rw-r--r-- | views/randimg.html.php | 2 |
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> |
