Piwigo / piwigo-bootstrap-darkroom

A mobile-ready and feature-rich theme for Piwigo photo gallery, based on Bootstrap 4
Apache License 2.0
83 stars 40 forks source link

after upgrade album thumbnails are huge on main page #297

Open tessus opened 2 years ago

tessus commented 2 years ago

I've upgraded Piwigo from 2.10.1 to 12.1..0 and thus bootstrap-darkroom was also upgraded to 2.5.0.

Since then there are 2 issues and I believe they are connected to the theme:

  1. All of a sudden my main gallery page shows huge album thumbnails. Before the upgrade they looked like the ones in a sub album (see here). Couldn't find a setiing or maybe I missed it. all thumbnails are huge. Or is this the new look?
  2. I opened https://github.com/Piwigo/Piwigo/issues/1562 but after looking into the file, I saw that it was generated from this theme. I do not know, if this is a problem with the theme, piwigo, or the smarty system.

Any ideas?

tessus commented 2 years ago

It seems that all thumbnails are now huge. At least when the "old" ones are not in the browser cache.

So this is how it looked before (image 1):

image

And how it looks now (image 2):

image

Please help. I really do not like these huge album thumbnails and I don't know how to fix this.

tessus commented 2 years ago

I believe I found another clue.

When I start off with a browsesr with a clean cache and go to the gallery these huge icons show up. I can get to the normal view when clicking on the Grid view icon image and then I have to reload the page. After that all pages are shown correctly with the album thumbnails in the correct size.

It seems that for some reason this javascript code is not loaded on page load when the browser cache is empty.

If the cookie view is not set (with a value of either grid or list), these huge thumbnails (see image 1 in previous comment) show up. It looks to me that in the code there's no default value set and thus this weird behavior happens, when the browser cache is clean and there's no cookie view.

@tkuther ^^^^

tessus commented 2 years ago

@plegall It seems that tkuther might not be maintaining this anymore. I believe I found the problem as described in the previous comment.

Unfortunately I do not know how to fix this myself. (To reproduce this, you only have to clear your browser cache/cookies and go to a piwigo instance that is using Darkroom.)

tessus commented 2 years ago

For anyone who's running into the same issue, here's a fix:

--- include/common.inc.php.orig 2021-12-07 00:19:43.456348537 +0100
+++ include/common.inc.php  2021-12-07 00:21:41.602356432 +0100
@@ -8,6 +8,15 @@

 defined('PHPWG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR);

+// workaround for UI garbage when cookie is missing
+// /ref https://github.com/tkuther/piwigo-bootstrap-darkroom/issues/297
+if (!isset($_COOKIE['view']))
+{
+    setcookie('view', 'grid', 0, '/');
+    header('Location: '.$_SERVER['REQUEST_URI']);
+    exit();
+}
+
 // determine the initial instant to indicate the generation time of this page
 $t2 = microtime(true);