Announcement

#1 2021-10-13 18:16:01

AJDesigns
Member
2021-10-13
3

Importing with thumbnails

Hi!

I'm setting up a new gallery - currently just a vanilla installation, no plugins or customisations yet. Default modus theme.

I have a set of (several thousand) PNG images and associated thumbnails that I wish to use.  The thumbnails are NOT simply resized main images, but are a selected region of the larger image. Sizes of both images vary wildly, depending on the original content.  I do NOT want a resized image in the gallery views, simply because they would be too small in most cases to discern the contents. (Some main images are particularly large.) 

I have used the ftp/synchronise option to import a sample of the images which works, but I am struggling in how to use the thumbnail images I have in the main gallery display.  I've tried putting them in subfolders 'thumbnail' and 'pwg_representative' before doing the sync, but to no effect.

Is there something I am missing or is it not possible to override the automatic thumbnail generation on import?  I am happy to run some further processing on the thumbnails to regularise the sizes if it helps.

Thanks

AJ

Offline

 

#2 2021-10-13 19:19:43

erAck
Only trying to help
2015-09-06
1060

Re: Importing with thumbnails

In some upload context it is possible to shove thumbnail representatives in a pwg_representative subdirectory, so for path/filename.ext have path/pwg_representative/filename.jpg (meant for non-image file formats). But I have no idea if and how that would work with / survive a "ftp" directory sync. If there is such then the representative's file name extension is stored in table piwigo_images column representative_ext.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2021-10-13 22:38:23

TOnin
Member
1970-01-01
60

Re: Importing with thumbnails

For an image

Code:

galleries/path-to/file.ext

the thumbnail is

Code:

_data/i/galleries/path-to/file-th.ext

Offline

 

#4 2021-10-13 23:18:21

erAck
Only trying to help
2015-09-06
1060

Re: Importing with thumbnails

Those _data/i/... thumbnails are generated though and when regenerating may get overwritten. They are also generated for .../pwg_representative/*.jpg files.


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2021-10-13 23:41:29

AJDesigns
Member
2021-10-13
3

Re: Importing with thumbnails

Thank you; loading the thumbnails in there with that name worked, in the sense it's now using them.

BUT it's still displaying them in the same proportions as the original image, not using the thumbnail proportions.  (e.g. main image is 590x7852, tall and skinny, whereas my thumbnail is 65x148, so a little more reasonable.  However it is constrained to a cell  10x144 ...  I've tried digging through the source and themes but haven't yet worked out where it's specifying this .


Edit:
I found and edited include/derivative.inc.php, class DerivativeImage, function get_size to:

Code:

 function get_size()
  {
    $r = @getimagesize(PHPWG_ROOT_PATH.$this->rel_path);
    if (is_array($r)) return $r;

    if ($this->params == null)
    {
      return $this->src_image->get_size();
    }
    return $this->params->compute_final_size($this->src_image->get_size());
  }

This may or may not be a good way to deal with this, but it seems to work for me ...

Last edited by AJDesigns (2021-10-14 00:54:06)

Offline

 

#6 2021-10-14 10:04:04

TOnin
Member
1970-01-01
60

Re: Importing with thumbnails

Ok, your "BUT" is only concerning mobile SmartPocket theme, as replacing thumbnails files is enough to make it works as you want for elegant theme (without editing code).

Offline

 

#7 2021-10-14 18:45:28

AJDesigns
Member
2021-10-13
3

Re: Importing with thumbnails

Thank you.... I'm obviously new to this.  Checking other themes now too. :)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2021 · Contact