If I restart my web browser or if someone visits for the first time or if I open a private browsing window, then on the first page load the back.png will not load as the HTML will contain this:
<body class="twg" style="background-image: url(image.php?twg_album=&twg_type=png&twg_show=back.png) !important; background-attachment:fixed !important; background-color: transparent !important; "><style>#twg_content_div { background-image: url(image.php?twg_album=&twg_type=png&twg_show=back.png) !important; background-attachment:fixed !important; }</style>
That URL does not result in loading the background image, seems to be because of the "&", if I replace them with just "&" then it will load
On subsequent loads, the background image displays properly and it's pulling from the cache directory:
<body class="twg" style="background-image: url(cache/bg_7cd52b8f795216ed5c33de697cf9485e0b1368bf.jpg) !important; background-attachment:fixed !important; background-color: transparent !important; "><style>#twg_content_div { background-image: url(cache/bg_7cd52b8f795216ed5c33de697cf9485e0b1368bf.jpg) !important; background-attachment:fixed !important; }</style>
I'm going to attempt to work around this by rewriting the &'s to just &
a
I was able to work around the issue with this:
RewriteCond %{QUERY_STRING} ^(.*)&(.*)&(.*)$ RewriteRule ^(.*)$ $1?%1&%2&%3 [R,L]
So on the first page load, the bad URL:
image.php?twg_album=&twg_type=png&twg_show=back.png
gets redirected to this good URL:
image.php?twg_album=&twg_type=png&twg_show=back.png
s
I'm seeing additional strangeness on first load versus subsequent loads
First load honors the "Number of thumbnails in a row" setting while subsequent loads ignore this and place as many as will fit
For example with 23 images
First load gives 6 images on first 3 rows and 5 images on last row
Subsequent loads give 14 images on first row and 9 images on second row
Hi,
which browser do you use? Because this is normal url encoding! I tested with chrome and Firefox and both work fine!
See: https://www.tinywebgallery.com/demo/twg_album/03_Mexico+%282004%29
But you are right. at this place no encoding is needed.
I fixed this already in my code:
open bodytag.inc.php and look for
$background_tmp = $install_dir_view . 'image.php?twg_album=' . $album_enc .......
change it to
$background_tmp = $install_dir_view . 'image.php?twg_album=' . $album_enc . '&twg_type=png&twg_show=back.png';
About the
Number of thumbnails in a row
At the first call the gallery does not know the browser width. After 1st call it tries to optimize this because then it is known.
you have "autodetect_maximum_thumbnails" enabled. Therefore this is the expected behavior. If you disable this you get your fixed sizes.
You can also use https://www.tinywebgallery.com/demo/twg_album/01_Administration~01_masonry
then an automatic optimization is done right from the start as this is Javascript only.
Best regards, Michael
I primarily use Firefox
If I go to your gallery, the background image does display on first visit (didn't work on my gallery for some reason), but if I right click and "View Background Image" there's nothing, and if I try to Curl the URL with the &'s in it, it's just an empty response (note no content-length):
$ curl -I 'https://www.tinywebgallery.com/demo/image.php?twg_album=03_Mexico+%282004%29&twg_type=png&twg_show=back.png' HTTP/2 200 date: Tue, 25 May 2021 23:18:53 GMT server: Apache/2.4.46 (Unix) x-powered-by: PHP/8.0.6 expires: Thu, 19 Nov 1981 08:52:00 GMT cache-control: no-store, no-cache, must-revalidate pragma: no-cache vary: User-Agent,Accept-Encoding content-type: text/html; charset=UTF-8 set-cookie: PHPSESSID=0scd8o432c6u8b0rmo25vm1gvt; path=/ accept-ranges: none $ curl 'https://www.tinywebgallery.com/demo/image.php?twg_album=03_Mexico+%282004%29&twg_type=png&twg_show=back.png' $
On the other hand if I replace the & with & then I'm able to curl it:
$ curl -I 'https://www.tinywebgallery.com/demo/image.php?twg_album=03_Mexico+%282004%29&twg_type=png&twg_show=back.png' HTTP/2 200 date: Tue, 25 May 2021 23:23:19 GMT server: Apache/2.4.46 (Unix) x-powered-by: PHP/8.0.6 expires: Thu, 19 Nov 1981 08:52:00 GMT cache-control: no-store, no-cache, must-revalidate pragma: no-cache vary: User-Agent,Accept-Encoding content-length: 69496 content-type: image/jpeg set-cookie: PHPSESSID=be1r39k5s0psmfq6t2vsur3h0f; path=/ $ curl 'https://www.tinywebgallery.com/demo/image.php?twg_album=03_Mexico+%282004%29&twg_type=png&twg_show=back.png' Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: <FILE>" to save to a file. $
Anyway if you've updated to replace the &'s then all should be good, I'll try the updated version at some point but for now I have a rewrite rule in place that's working fine.
URL encoding in curl does of course not work. In the next small update this will be fixed. and like I wrote you you can easily also fix this... only removing the amp in the line mentioned :).
Best regards,
Michael