From cac417c74bc6d5f528b356190561d244e9b4f93a Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 12 Jan 2012 21:37:28 +0000 Subject: feature 2548, multiple size: * adapt the upload script * remove the resize settings screen * add a new screen [Administration > Configuration > Options > Photo Sizes] with the ability to resize original after upload git-svn-id: http://piwigo.org/svn/trunk@12879 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'admin/configuration.php') diff --git a/admin/configuration.php b/admin/configuration.php index a59e815fc..bc6f3634d 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -27,6 +27,7 @@ if( !defined("PHPWG_ROOT_PATH") ) } include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); +include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); // +-----------------------------------------------------------------------+ @@ -54,6 +55,10 @@ $main_checkboxes = array( 'allow_user_customization', ); +$sizes_checkboxes = array( + 'original_resize', + ); + $history_checkboxes = array( 'log', 'history_admin', @@ -182,6 +187,36 @@ if (isset($_POST['submit'])) } break; } + case 'sizes' : + { + $fields = array( + 'original_resize', + 'original_resize_maxwidth', + 'original_resize_maxheight', + 'original_resize_quality', + ); + + $updates = array(); + + foreach ($fields as $field) + { + $value = !empty($_POST[$field]) ? $_POST[$field] : null; + $form_values[$field] = $value; + $updates[$field] = $value; + } + + save_upload_form_config($updates, $page['errors']); + + if (count($page['errors']) == 0) + { + array_push( + $page['infos'], + l10n('Your configuration settings are saved') + ); + } + + break; + } case 'history' : { foreach( $history_checkboxes as $checkbox) @@ -228,7 +263,7 @@ if (isset($_POST['submit'])) } // updating configuration if no error found - if (count($page['errors']) == 0) + if ('sizes' != $page['section'] and count($page['errors']) == 0) { //echo '
'; print_r($_POST); echo '
'; $result = pwg_query('SELECT param FROM '.CONFIG_TABLE); @@ -268,6 +303,7 @@ $template->set_filename('config', 'configuration.tpl'); $tabsheet = new tabsheet(); // TabSheet initialization $tabsheet->add('main', l10n('Main'), $conf_link.'main'); +$tabsheet->add('sizes', l10n('Photo Sizes'), $conf_link.'sizes'); $tabsheet->add('display', l10n('Display'), $conf_link.'display'); $tabsheet->add('history', l10n('History'), $conf_link.'history'); $tabsheet->add('comments', l10n('Comments'), $conf_link.'comments'); @@ -439,6 +475,30 @@ switch ($page['section']) ); break; } + case 'sizes' : + { + $template->assign( + 'sizes', + array( + 'original_resize_maxwidth' => $conf['original_resize_maxwidth'], + 'original_resize_maxheight' => $conf['original_resize_maxheight'], + 'original_resize_quality' => $conf['original_resize_quality'], + ) + ); + + foreach ($sizes_checkboxes as $checkbox) + { + $template->append( + 'sizes', + array( + $checkbox => $conf[$checkbox] + ), + true + ); + } + + break; + } } //----------------------------------------------------------- sending html code -- cgit v1.2.3