summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2007-06-06 20:01:54 +0000
committerAndreas Unterkircher <unki@netshadow.at>2007-06-06 20:01:54 +0000
commitbbf672d2d4744cfa8c0b652cea2492b35acd7dc1 (patch)
tree8093b177560e42ae47ee6394317a0a8039e7d994
parentca33ffdcbb65a0b344e450966c2fcff1d9e9212b (diff)
fix previous & next image in single photo view
git-svn-id: file:///var/lib/svn/phpfspot/trunk@26 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r--phpfspot.class.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index dbefee8..6d66aae 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -118,16 +118,33 @@ class PHPFSPOT {
public function showPhoto($photo)
{
+ $all_photos = $this->getAllTagPhotos();
+
+ foreach($all_photos as $all_photo) {
+
+ if($get_next) {
+ $next_img = $all_photo;
+ break;
+ }
+
+ if($all_photo == $photo) {
+ $get_next = 1;
+ }
+ else {
+ $previous_img = $all_photo;
+ }
+ }
+
if(isset($photo)) {
$this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&amp;width=". $this->cfg->photo_width);
}
- if($photo > 0) {
- $this->tmpl->assign('previous_url', "javascript:showImage(". ($photo-1) .");");
+ if($previous_img) {
+ $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");");
}
- if($photo < count($this->photos)) {
- $this->tmpl->assign('next_url', "javascript:showImage(". ($photo+1) .");");
+ if($next_img) {
+ $this->tmpl->assign('next_url', "javascript:showImage(". $next_img .");");
}
$this->tmpl->show("single_photo.tpl");