Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Wrong offset in forward button link in thumbnail view
https://www.tinywebgallery.com/forum/viewtopic.php?f=5&t=3898
Page 1 of 1

Author:  pal [ 13. Jul 2015, 12:49 ]
Post subject:  Wrong offset in forward button link in thumbnail view

In thumbnail view, the forward button does not always have the same link as the next page number button.
When e.g. thumbnail page 2 is shown, the forward button and "3" button have different twg_offsets in their links.
The number button is always correct, but the forward button is wrong from page 2 and up.

I think it has something to do with my album having a subdir, thus page 1 has fewer thumbnails.
In my setup, page 1 has a subdir + 7 x 1 thumbnails while page 2 and up have 7 x 3 thumbnails.
In page 1, the forward button has twg_offset=7 which is correct.
In page 2, the forward button has twg_offset=14 which should have been 28. The "3" button however has twg_offset=28.
This also gives the effect that when page 2 is displayed and if pressing the forward button, a single thumbnail row is shifted up and the active page is still at 2.

I found a solution to my case, but it might have some undesired side effects in other cases:
Code:
--- a/inc/index.inc.php 2015-07-13 11:32:02 +0200
+++ b/inc/index.inc.php 2015-07-13 11:37:51 +0200
@@ -636,8 +636,8 @@
             }
         }
         if ($actpage != $numpages - 1) {
-            $hrefnext = getScriptName() . '?twg_album=' . $album_enc . '&twg_offset=' . ($twg_offset + $thumbnails- $missing_images_page_one) . $twg_standalone;
-            $hrefnextjs = getScriptName() . '?twg_album=' . $album_enc . '&twg_offset=' . ($twg_offset + $thumbnails- $missing_images_page_one) . $twg_standalonejs;
+            $hrefnext = getScriptName() . '?twg_album=' . $album_enc . '&twg_offset=' . (($actpage + 1) * $thumbnails - $missing_images_page_one) . $twg_standalone;
+            $hrefnextjs = getScriptName() . '?twg_album=' . $album_enc . '&twg_offset=' . (($actpage + 1) * $thumbnails - $missing_images_page_one) . $twg_standalonejs;
             echo '<script type="text/javascript"> function key_foreward() { location.href="' . $hrefnextjs . '" } </script>';
             printf("&nbsp;<a href='%s'>%s</a> ", tfu_seo_rewrite_url($hrefnext), $lang_thumb_forward);
         } else {

I think this is the only relevant parameter from my_config.php:
Code:
$use_nonscrolling_dhtml=true;

Author:  TinyWebGallery [ 18. Jul 2015, 23:00 ]
Post subject:  Re: Wrong offset in forward button link in thumbnail view

Thanks. I'll check this and add the fix to the next version if it also works fine for me.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/