Actually I made more tests and it seems SmartPocket theme is more smarter then GDthumb or Gthumb+
If you set Piwigo thumbnails size to "648x216px" and "crop" option is disabled, SmartPocket will not generate another derivatives but use the core derivative instead.
Custom size "648x216_z_0x216" will appear in the Piwigo derivatives list, but if you check the /_data/i/... they are no generated files with this name. Instead if "filename-th.JPG" not exist, they will be generated when SmartPocked albums are first accessed.
I had a look at the code
/themes/smartpocket/themeconf.inc.php
class SPThumbPicker
{
var $candidates;
var $default;
var $height;
function init($height)
{
$this->candidates = array();
foreach( ImageStdParams::get_defined_type_map() as $params)
{
if ($params->max_height() < $height || $params->sizing->max_crop)
continue;
if ($params->max_height() > 3*$height)
break;
$this->candidates[] = $params;
}
$this->default = ImageStdParams::get_custom($height*3, $height, 1, 0, $height );
$this->height = $height;
}
function pick($src_image)
{
$ok = false;
foreach($this->candidates as $candidate)
{
$deriv = new DerivativeImage($candidate, $src_image);
$size = $deriv->get_size();
if ($size[1]>=$row_height-2)
{
$ok = true;
break;
}
}
if (!$ok)
{
$deriv = new DerivativeImage($this->default, $src_image);
}
return $deriv;
}
}
I'm not to good with php and piwigo but probably "ImageStdParams::get_defined_type_map()" build a array with existing sizes and loop "foreach($this->candidates as $candidate)" check if similar size exist.
then in "/themes/smartpocket/template/thumbnails.tpl"
{$derivative=$thumb_picker->pick($thumbnail.src_image)}
"pick" function is used