Piwigo.org

You are not logged in. (Register / Login)

Announcement

#136 2017-03-15 20:59:31

moose
Member
Location: Upper Bavaria, Germany
Registered: 2013-01-03
Posts: 35

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

Hi Serge,

what a great pleasure to see you're active here in the Piwigo community! I remember you from the Gallery community and from building the Grey Dragon theme which I used with Gallery3.

But now, i.e. a few weeks ago I decided to move my old Gallery3 website to Piwigo. And, doing so I decided to make it 'responsive'. I'm doing so by using the 'Bootstrap darkroom' theme and your extension GDThmub which works great for. Many thanks for contributing it to the Piwigo project!

I've just one question about your extension: Would it be possible to change the behavior how the photos in the last row are shown? I.e. as far as I see in my albums they will be 'stretched' horizontal if there are not enough photos to fill one row completely. But, I'd like to show them 'unstretched', i.e. in their standard aspect ratio.

Do you think changing/adding this behavior, let's say selectable by a further checkbox on the extensions settings page would be a big deal?

Before trying myself to modify the extensions code I'd like to ask you first. Maybe, it's already on your roadmap and developing the same thing twice makes no sence. Or I can fork your code and if you like my changes you feel free to merge it later.

What do you think will be the easyest way to modify the GDThumb extension? If you don't have any time or do not want to add this feature: do you have any hints for me to help myself?

Again, thanks for your great extension and greetinx

moose

Please, find attached sample screenshots.


Uploaded Images

Last edited by moose (2017-03-15 21:04:35)

Offline

 

#137 2017-03-17 23:52:11

moose
Member
Location: Upper Bavaria, Germany
Registered: 2013-01-03
Posts: 35

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

After some searching I found the related code in file plugins/GDThumb/js/gdthumb.js and patched it this way:

--- gdthumb.js                 2017-03-17 23:22:28.596000000 +0100
+++ gdthumb_new.js    2017-03-17 23:24:10.952000000 +0100
@@ -254,9 +254,30 @@
       last_height = GDThumb.max_height;
     }

-    // Last line does not need to be cropped
+    // crop last line also, but only if we have more than one line
     for (j=0;j<thumb_process.length;j++) {
-      GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, thumb_process[j].width, last_height, false);
+
+      // we have only one line, i.e. the first line is the one and only line and therefor the last line too
+      if (line == 1) {
+        GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, thumb_process[j].width, last_height, false);
+      }
+      // we have more than one line
+      else {
+        if ((GDThumb.method == 'square') || (GDThumb.method == 'slide')) {
+          new_width = GDThumb.max_height;
+          new_height = GDThumb.max_height;
+        }
+        else {
+          new_width = (thumb_process[j].width + round_rest) / ratio;
+          round_rest = new_width - Math.round(new_width);
+          new_width = Math.round(new_width);
+        }
+
+        GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, new_width, new_height, false);
+        last_height = Math.min(last_height, new_height);
+
+        width_count += new_width + GDThumb.margin;
+      }
     }

     if (main_width != jQuery('ul.thumbnails').width()) {

This works fine for me in the way described in my last post.

Greetinx

moose

Last edited by moose (2017-03-18 00:04:03)

Offline

 

#138 2017-03-18 20:06:59

Guillaume C
Member
Registered: 2017-02-11
Posts: 7

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

moose wrote:

This works fine for me in the way described in my last post.

Greetinx

moose

It works fine for me too.
Thanks :-)

Offline

 

#139 2017-03-21 23:36:04

Serge D
Member
Location: US
Registered: 2014-07-15
Posts: 315

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

eliz82 wrote:

depends what you mean by "critical". for me the fact that the multiuser part of this software is simply not working
[Github] Piwigo-community issue #20
[Github] Piwigo-community issue #15
and I cannot use this software to build a community is ... "critical".

Fair enough. I would encourage to tone it down a notch as it would discourage people to help you. :)

eliz82 wrote:

Serge D wrote:

moving captions to the left is by design

:) that moving to the left of captions only appear when PWG stuff is activated, this is not normal behavior for Gdthumb or Gthumb+. PWG stuff block has nothing to do with the masonry style of thumbnails (Gdtumb or Gthumb+), it should not affect them.
Of course is a CSS problem, i fixed 6 months ago :) but this kind of problems and conflicts between the plugins should be fixed officially not by every user to write custom CSS.

Ok, post your solution here, and I will test/add it into plugin's CSS

eliz82 wrote:

I expect PWG stuff plugin to work like it's working when Gdthumb plugin is not activated :) .  Just deactivate the Gdthumb plugin and see how PWG stuff plugin default behavior is. Simply be able to put a block with the most recent pictures under the gallery. When Gdthumb is activated the behavior and formatting of PWG stuff block should remain the same.

I already written the previous posts Gdthumb with the default settings. I installed, activated and that is all, i didn't even clicked to see the the options.

There is a thing, gdThumb modifies the structure of the page this throws PWG stuff off since it cannot find specific html tags
unfortunately widget/block management in Piwigo is very simple and does not allow for plug-and-play as it is lets say in WordPress.
As result one can run into issues with different plugins as they do not account that page content structure may change
I am not planing at this time change how gdThumb generates the code for the page but will take a look if I can trick PWG stuff plugin into adding its code into some otherwise invisible node.

Offline

 

#140 2017-03-21 23:38:40

Serge D
Member
Location: US
Registered: 2014-07-15
Posts: 315

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

moose wrote:

After some searching I found the related code in file plugins/GDThumb/js/gdthumb.js and patched it this way:

...

This works fine for me in the way described in my last post.

Greetinx

moose

Looks nice, I'll see if I can add it into core code
Thank you for your contribution

Offline

 

#141 2017-03-22 08:04:14

moose
Member
Location: Upper Bavaria, Germany
Registered: 2013-01-03
Posts: 35

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

Serge D wrote:

Looks nice, I'll see if I can add it into core code
Thank you for your contribution

It's rather my task to thank you for your great work which made my little change possible at all!

Offline

 

#142 2017-03-30 04:46:01

Design by Sue
Member
Registered: 2017-03-27
Posts: 24

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

Not sure if that is what they are called, but when you hover over a photo in my gallery a small text window appears with the name of the photo or album.  This is distracting because I am using gdThumb which shows that information.  Can you tell me how to turn off this hover text?

Also I see how to set the number of pictures on a page, but the number of albums displayed (for my install at least) seems to be stuck on 8.  Is this something your plug in does or do you know where this setting can be found?

Thank you for your plug in - I really like the look I am getting.

www.designbysue.com/photos

Thanks
Sue

Offline

 

#143 2017-04-26 14:35:05

joshuaavalon
Member
Registered: 2017-04-26
Posts: 1

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

When I select square, it seems that it crops at the center instead of respecting center of interset

Offline

 

#144 2017-06-20 22:03:41

eliz82
Member
Location: Romania
Registered: 2016-04-27
Posts: 142
Website

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

plugins/GDThumb/template/gdthumb_cat.tpl

i find this piece of code strange

Code:

.thumbnailCategories .gdthumb {ldelim} margin: {$GDThumb.margin / 2}px {$GDThumb.margin / 2}px {$GDThumb.margin - $GDThumb.margin / 2}px {$GDThumb.margin - $GDThumb.margin / 2}px !important; }

lets take this mathematically
x - x/2 is actually ... x/2

isn't this the same thing but much more simple? :)

Code:

.thumbnailCategories .gdthumb {ldelim} margin: {$GDThumb.margin / 2}px  !important; }

p.s.  by the way ... a future request. it will be nice to allow in the options different margins for thumbnails for albums and photos. this will allow to stylize the album thumbnails, put them a border shadow while keeping a small margin size for normal photos.

Offline

 

#145 2017-07-21 21:14:59

sunbeam11
Member
Location: DE
Registered: 2017-07-21
Posts: 2

Re: [Plugin] gdThumb - Masonry style thumbs in your gallery - 1.0.20

Hi all together,

@moose
Thanks for this one, works like a charm.
No more stretched pics in the last row.
Maybe these lines will find their way into Serge's core code... ;-)

Code:

--- gdthumb.js                 2017-03-17 23:22:28.596000000 +0100
+++ gdthumb_new.js    2017-03-17 23:24:10.952000000 +0100
@@ -254,9 +254,30 @@
       last_height = GDThumb.max_height;
     }

-    // Last line does not need to be cropped
+    // crop last line also, but only if we have more than one line
     for (j=0;j<thumb_process.length;j++) {
-      GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, thumb_process[j].width, last_height, false);
+
+      // we have only one line, i.e. the first line is the one and only line and therefor the last line too
+      if (line == 1) {
+        GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, thumb_process[j].width, last_height, false);
+      }
+      // we have more than one line
+      else {
+        if ((GDThumb.method == 'square') || (GDThumb.method == 'slide')) {
+          new_width = GDThumb.max_height;
+          new_height = GDThumb.max_height;
+        }
+        else {
+          new_width = (thumb_process[j].width + round_rest) / ratio;
+          round_rest = new_width - Math.round(new_width);
+          new_width = Math.round(new_width);
+        }
+
+        GDThumb.resize(jQuery('ul.thumbnails img.thumbnail').eq(thumb_process[j].index), thumb_process[j].real_width, thumb_process[j].real_height, new_width, new_height, false);
+        last_height = Math.min(last_height, new_height);
+
+        width_count += new_width + GDThumb.margin;
+      }
     }

     if (main_width != jQuery('ul.thumbnails').width()) {

Thanks for this fine Extension, Serge!


Uploaded Images

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2017 · Contact