Ignore:
Timestamp:
Jan 12, 2012, 10:37:28 PM (13 years ago)
Author:
plg
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r12872 r12879  
    2828
    2929include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     30include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    3031include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    3132
     
    5455    'allow_user_customization',
    5556   );
     57
     58$sizes_checkboxes = array(
     59    'original_resize',
     60  );
    5661
    5762$history_checkboxes = array(
     
    183188      break;
    184189    }
     190    case 'sizes' :
     191    {
     192      $fields = array(
     193        'original_resize',
     194        'original_resize_maxwidth',
     195        'original_resize_maxheight',
     196        'original_resize_quality',
     197        );
     198
     199      $updates = array();
     200     
     201      foreach ($fields as $field)
     202      {
     203        $value = !empty($_POST[$field]) ? $_POST[$field] : null;
     204        $form_values[$field] = $value;
     205        $updates[$field] = $value;
     206      }
     207
     208      save_upload_form_config($updates, $page['errors']);
     209 
     210      if (count($page['errors']) == 0)
     211      {
     212        array_push(
     213          $page['infos'],
     214          l10n('Your configuration settings are saved')
     215          );
     216      }
     217
     218      break;
     219    }
    185220    case 'history' :
    186221    {
     
    229264
    230265  // updating configuration if no error found
    231   if (count($page['errors']) == 0)
     266  if ('sizes' != $page['section'] and count($page['errors']) == 0)
    232267  {
    233268    //echo '<pre>'; print_r($_POST); echo '</pre>';
     
    269304// TabSheet initialization
    270305$tabsheet->add('main', l10n('Main'), $conf_link.'main');
     306$tabsheet->add('sizes', l10n('Photo Sizes'), $conf_link.'sizes');
    271307$tabsheet->add('display', l10n('Display'), $conf_link.'display');
    272308$tabsheet->add('history', l10n('History'), $conf_link.'history');
     
    440476    break;
    441477  }
     478  case 'sizes' :
     479  {
     480    $template->assign(
     481      'sizes',
     482      array(
     483        'original_resize_maxwidth' => $conf['original_resize_maxwidth'],
     484        'original_resize_maxheight' => $conf['original_resize_maxheight'],
     485        'original_resize_quality' => $conf['original_resize_quality'],
     486        )
     487      );
     488   
     489    foreach ($sizes_checkboxes as $checkbox)
     490    {
     491      $template->append(
     492        'sizes',
     493        array(
     494          $checkbox => $conf[$checkbox]
     495          ),
     496        true
     497        );
     498    }
     499
     500    break;
     501  }
    442502}
    443503
Note: See TracChangeset for help on using the changeset viewer.