From dd1f034df2bb54a7e40c78d666c607acc1820c0b Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 19 Apr 2012 20:49:43 +0000 Subject: added a button to restore multiple size default sizes ... git-svn-id: http://piwigo.org/svn/trunk@14228 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 6 +++++ admin/themes/default/template/configuration.tpl | 20 ++++++++-------- include/derivative_std_params.inc.php | 31 +++++++++++++++---------- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/admin/configuration.php b/admin/configuration.php index 4258c3437..c89203d4f 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -248,6 +248,12 @@ WHERE param = \''.$row['param'].'\' //------------------------------------------------------ $conf reinitialization load_conf_from_db(); } +elseif (isset($_POST['restore_settings'])) +{ + ImageStdParams::set_and_save( ImageStdParams::get_default_sizes() ); + pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = \'disabled_derivatives\''); + clear_derivative_cache(); +} //----------------------------------------------------- template initialization $template->set_filename('config', 'configuration.tpl'); diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index d6f0b0064..94f9b4529 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -30,9 +30,7 @@ jQuery(document).ready(function(){ }); {/literal}{/footer_script} -
-

{'Piwigo configuration'|@translate} {$TABSHEET_TITLE}

-
+

{'Piwigo configuration'|@translate} {$TABSHEET_TITLE}

{if !isset($default)}
@@ -314,13 +312,13 @@ jQuery(document).ready(function(){ jQuery("#showDetails").click(function() { jQuery(".sizeDetails").show(); jQuery(this).css("visibility", "hidden"); + return false; }); }); {/literal}{/footer_script} -{html_head}{literal} - -{/literal}{/html_head} +{/literal}{/html_style}
{'Original Size'|@translate} @@ -643,9 +640,12 @@ input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;} {/if} {if !isset($default)} -

- -

+

+ +{if isset($sizes)} + +{/if} +

{/if} diff --git a/include/derivative_std_params.inc.php b/include/derivative_std_params.inc.php index 06365e822..e1a15c882 100644 --- a/include/derivative_std_params.inc.php +++ b/include/derivative_std_params.inc.php @@ -112,7 +112,8 @@ final class ImageStdParams } else { - self::make_default(); + self::$watermark = new WatermarkParams(); + self::$type_map = self::get_default_sizes(); } self::build_maps(); } @@ -141,18 +142,24 @@ final class ImageStdParams conf_update_param('derivatives', addslashes($ser) ); } - private static function make_default() + static function get_default_sizes() { - self::$watermark = new WatermarkParams(); - self::$type_map[IMG_SQUARE] = new DerivativeParams( SizingParams::square(120,120) ); - self::$type_map[IMG_THUMB] = new DerivativeParams( SizingParams::classic(144,144) ); - self::$type_map[IMG_XXSMALL] = new DerivativeParams( SizingParams::classic(240,240) ); - self::$type_map[IMG_XSMALL] = new DerivativeParams( SizingParams::classic(432,324) ); - self::$type_map[IMG_SMALL] = new DerivativeParams( SizingParams::classic(576,432) ); - self::$type_map[IMG_MEDIUM] = new DerivativeParams( SizingParams::classic(792,594) ); - self::$type_map[IMG_LARGE] = new DerivativeParams( SizingParams::classic(1008,756) ); - self::$type_map[IMG_XLARGE] = new DerivativeParams( SizingParams::classic(1224,918) ); - self::$type_map[IMG_XXLARGE] = new DerivativeParams( SizingParams::classic(1656,1242) ); + $arr = array( + IMG_SQUARE => new DerivativeParams( SizingParams::square(120,120) ), + IMG_THUMB => new DerivativeParams( SizingParams::classic(144,144) ), + IMG_XXSMALL => new DerivativeParams( SizingParams::classic(240,240) ), + IMG_XSMALL => new DerivativeParams( SizingParams::classic(432,324) ), + IMG_SMALL => new DerivativeParams( SizingParams::classic(576,432) ), + IMG_MEDIUM => new DerivativeParams( SizingParams::classic(792,594) ), + IMG_LARGE => new DerivativeParams( SizingParams::classic(1008,756) ), + IMG_XLARGE => new DerivativeParams( SizingParams::classic(1224,918) ), + IMG_XXLARGE => new DerivativeParams( SizingParams::classic(1656,1242) ), + ); + foreach($arr as $params) + { + $params->last_mod_time = time(); + } + return $arr; } static function apply_global($params) -- cgit v1.2.3