Ignore:
Timestamp:
Jul 20, 2015, 1:45:59 AM (9 years ago)
Author:
SergeD
Message:

version 1.0.18 - refer to changelog for more details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GDThumb/main.inc.php

    r31134 r31245  
    22/*
    33Plugin Name: gdThumb
    4 Version: 1.0.17
     4Version: 1.0.18
    55Description: Apply Masonry style to album or image thumbs
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=771
     
    1919// | Plugin constants                                               |
    2020// +-----------------------------------------------------------------------+
    21 define('GDTHUMB_VERSION', '1.0.17');
     21define('GDTHUMB_VERSION', '1.0.18');
    2222define('GDTHUMB_ID',      basename(dirname(__FILE__)));
    2323define('GDTHUMB_PATH' ,   PHPWG_PLUGINS_PATH . GDTHUMB_ID . '/');
     
    2828if (!isset($conf['gdThumb'])):
    2929  include(dirname(__FILE__).'/config_default.inc.php');
    30 
    31   $query = '
    32 INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    33 VALUES ("gdThumb" , "'.addslashes(serialize($config_default)).'" , "GDThumb plugin parameters");';
    34   pwg_query($query);
     30  conf_update_param('gdThumb', $config_default);
    3531  load_conf_from_db();
    3632endif;
     
    113109  $template->set_filename( 'index_thumbnails', dirname(__FILE__) . '/template/gdthumb_thumb.tpl');
    114110  $template->assign('GDThumb', $confTemp);
    115   $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom(9999, $confTemp['height']));
     111  if (($confTemp['method'] == "slide") || ($confTemp['method'] == "square")):
     112    $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom($confTemp['height'], 9999));
     113  else:
     114    $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom(9999, $confTemp['height']));
     115  endif;
    116116
    117117  if ($confTemp['big_thumb'] and !empty($tpl_vars[0])):
    118     $derivative_params = ImageStdParams::get_custom(9999, 2 * $confTemp['height'] + $confTemp['margin']);
     118    if (($confTemp['method'] == "slide") || ($confTemp['method'] == "square")):
     119      $derivative_params = ImageStdParams::get_custom(2 * $confTemp['height'] + $confTemp['margin'], 9999);
     120    else:
     121      $derivative_params = ImageStdParams::get_custom(9999, 2 * $confTemp['height'] + $confTemp['margin']);
     122    endif;
    119123    $template->assign('GDThumb_big', new DerivativeImage($derivative_params, $tpl_vars[0]['src_image']));
    120124  endif;
     
    132136  $template->set_filename( 'index_category_thumbnails', dirname(__FILE__) . '/template/gdthumb_cat.tpl');
    133137  $template->assign('GDThumb', $confTemp);
    134   $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom(9999, $confTemp['height']));
     138  if (($confTemp['method'] == "slide") || ($confTemp['method'] == "square")):
     139    $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom($confTemp['height'], 9999));
     140  else:
     141    $template->assign('GDThumb_derivative_params', ImageStdParams::get_custom(9999, $confTemp['height']));
     142  endif;
    135143
    136144  if ($confTemp['big_thumb'] and !empty($tpl_vars[0])):
    137145    $id = $tpl_vars[0]["representative_picture_id"];
    138146    if (($id) && ($rep = $tpl_vars[0]["representative"])):
    139       $derivative_params = ImageStdParams::get_custom(9999, 2 * $confTemp['height'] + $confTemp['margin']);
     147      if (($confTemp['method'] == "slide") || ($confTemp['method'] == "square")):
     148        $derivative_params = ImageStdParams::get_custom(2 * $confTemp['height'] + $confTemp['margin'], 9999);
     149      else:
     150        $derivative_params = ImageStdParams::get_custom(9999, 2 * $confTemp['height'] + $confTemp['margin']);
     151      endif;
    140152      $template->assign('GDThumb_big', new DerivativeImage($derivative_params, $rep['src_image']));
    141153    endif;
Note: See TracChangeset for help on using the changeset viewer.