Philio / bootstrapdefault

A modern and responsive theme for Piwigo built with standard Bootstrap components and using the default Bootstrap theme. Intended for easy customisation using Bootstrap styles or as a parent theme for creating responsive themes for Piwigo.
https://philio.me
31 stars 10 forks source link

Should use standard sizes - Custom sizes can't be batch processed #55

Open anttix opened 7 years ago

anttix commented 7 years ago

Hi!

The theme uses custom sizes for everything. Even when XS or XXS etc are selected from the album thumbnail dropdown, Piwigo will not use existing images but will instead generate a custom size for the theme.

This is annoying to viewers because custom sizes can't be pre-processed from batch manager and the first user has to wait a significant amount of time until images are generated.

Philio commented 7 years ago

This should not be the case, the sizes menu is generated from the built in sizes in exactly the same way as the default theme.

The only custom sizes are the thumbnails, which should only be generated once (the first time they are viewed)

On 25 Mar 2017 6:35 pm, "Antti Andreimann" notifications@github.com wrote:

Hi!

The theme uses custom sizes for everything. Even when XS or XXS etc are selected from the album thumbnail dropdown, Piwigo will still generate a custom size for the theme.

This is annoying to viewers because custom sizes can't be pre-processed from batch manager and the fist viewer will have to wait a significant amount of time until images are generated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Philio/bootstrapdefault/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOhGpeCeIcg9R-izXfYJb82jwm-aKYiks5rpV5fgaJpZM4MpKyq .

anttix commented 7 years ago

Well the behavior is broken at least with Piwigo 2.8.6

Steps to reproduce:

  1. Go to batch manager and pre-generate image sizes for an album
  2. Go to the album page
  3. Switch to a different thumbnail size from the dropdown menu
  4. Observe that images load slowly
  5. Observe that images become rectangular
  6. Observe that image URL-s indicate custom sizing: e.g. /_data/i/upload/2013/11/12/20131112002803-2f11102a-cu_e240.JPG
  7. Go to /admin.php?page=configuration&section=sizes
  8. Click on "show details"
  9. Observe that there are new custom sizes (e.g. e240)

Adding stars around define_derivative seems to fix the problem.

--- template/thumbnails.tpl.orig    2017-03-25 10:55:53.948173947 -0700
+++ template/thumbnails.tpl 2017-03-25 12:19:02.175315577 -0700
@@ -5,15 +5,17 @@
 {if $derivative_params->type == "thumb"}
 {assign var=width value=260}
 {assign var=height value=180}
+{define_derivative name='derivative_params' width=$width height=$height crop=true}
 {else}
 {assign var=width value=$derivative_params->sizing->ideal_size[0]}
 {assign var=height value=$derivative_params->sizing->ideal_size[1]}
+{*define_derivative name='derivative_params' width=$width height=$height crop=true*}
 {/if}
-{define_derivative name='derivative_params' width=$width height=$height crop=true}
 <style>
     .placeholder-{$width} {
         width: {$width}px;
-        height: {$height}px;
+        min-height: 32px;
+        max-height: {$height}px;
         background: url({$ROOT_URL}{$themeconf.icon_dir}/img_small.png) no-repeat center;
     }
 </style>