aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-01-12 21:37:28 +0000
committerplegall <plg@piwigo.org>2012-01-12 21:37:28 +0000
commitcac417c74bc6d5f528b356190561d244e9b4f93a (patch)
tree98d7f341215bfec3e75de2dde0a2a2167d54b30c /admin
parent6a115001ba122c2084e28353e025f7c8c5f62335 (diff)
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
Diffstat (limited to '')
-rw-r--r--admin/batch_manager_global.php9
-rw-r--r--admin/configuration.php62
-rw-r--r--admin/include/functions_upload.inc.php221
-rw-r--r--admin/include/photos_add_direct_process.inc.php7
-rw-r--r--admin/include/uploadify/uploadify.php2
-rw-r--r--admin/photos_add.php4
-rw-r--r--admin/photos_add_settings.php125
-rw-r--r--admin/themes/default/template/configuration.tpl48
-rw-r--r--admin/themes/default/template/photos_add_settings.tpl163
9 files changed, 146 insertions, 495 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 73e3586b5..c6ee4bd0a 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -33,14 +33,6 @@ 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');
-
-$upload_form_config = get_upload_form_config();
-foreach ($upload_form_config as $param_shortname => $param)
-{
- $param_name = 'upload_form_'.$param_shortname;
- $form_values[$param_shortname] = $conf[$param_name];
-}
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
@@ -463,7 +455,6 @@ $template->assign(
'filter' => $_SESSION['bulk_manager_filter'],
'selection' => $collection,
'all_elements' => $page['cat_elements_id'],
- 'upload_form_settings' => $form_values,
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
'F_ACTION'=>$base_url.get_query_string_diff(array('cat')),
)
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 '<pre>'; print_r($_POST); echo '</pre>';
$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
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index 9181e3dc6..da2e9b700 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -32,110 +32,36 @@ function get_upload_form_config()
{
// default configuration for upload
$upload_form_config = array(
- 'websize_resize' => array(
- 'default' => true,
- 'can_be_null' => false,
- ),
-
- 'websize_maxwidth' => array(
- 'default' => 800,
- 'min' => 100,
- 'max' => 1600,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => true,
- 'error_message' => l10n('The websize maximum width must be a number between %d and %d'),
- ),
-
- 'websize_maxheight' => array(
- 'default' => 600,
- 'min' => 100,
- 'max' => 1200,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => true,
- 'error_message' => l10n('The websize maximum height must be a number between %d and %d'),
- ),
-
- 'websize_quality' => array(
- 'default' => 95,
- 'min' => 50,
- 'max' => 100,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => false,
- 'error_message' => l10n('The websize image quality must be a number between %d and %d'),
- ),
-
- 'thumb_maxwidth' => array(
- 'default' => 128,
- 'min' => 50,
- 'max' => 300,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => false,
- 'error_message' => l10n('The thumbnail maximum width must be a number between %d and %d'),
- ),
-
- 'thumb_maxheight' => array(
- 'default' => 96,
- 'min' => 50,
- 'max' => 300,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => false,
- 'error_message' => l10n('The thumbnail maximum height must be a number between %d and %d'),
- ),
-
- 'thumb_quality' => array(
- 'default' => 95,
- 'min' => 50,
- 'max' => 100,
- 'pattern' => '/^\d+$/',
- 'can_be_null' => false,
- 'error_message' => l10n('The thumbnail image quality must be a number between %d and %d'),
- ),
-
- 'thumb_crop' => array(
- 'default' => false,
- 'can_be_null' => false,
- ),
-
- 'thumb_follow_orientation' => array(
- 'default' => true,
- 'can_be_null' => false,
- ),
-
- 'hd_keep' => array(
- 'default' => true,
- 'can_be_null' => false,
- ),
-
- 'hd_resize' => array(
+ 'original_resize' => array(
'default' => false,
'can_be_null' => false,
),
- 'hd_maxwidth' => array(
+ 'original_resize_maxwidth' => array(
'default' => 2000,
'min' => 500,
'max' => 20000,
'pattern' => '/^\d+$/',
'can_be_null' => false,
- 'error_message' => l10n('The high definition maximum width must be a number between %d and %d'),
+ 'error_message' => l10n('The original maximum width must be a number between %d and %d'),
),
- 'hd_maxheight' => array(
+ 'original_resize_maxheight' => array(
'default' => 2000,
- 'min' => 500,
+ 'min' => 300,
'max' => 20000,
'pattern' => '/^\d+$/',
'can_be_null' => false,
- 'error_message' => l10n('The high definition maximum height must be a number between %d and %d'),
+ 'error_message' => l10n('The original maximum height must be a number between %d and %d'),
),
- 'hd_quality' => array(
+ 'original_resize_quality' => array(
'default' => 95,
'min' => 50,
- 'max' => 100,
+ 'max' => 98,
'pattern' => '/^\d+$/',
'can_be_null' => false,
- 'error_message' => l10n('The high definition image quality must be a number between %d and %d'),
+ 'error_message' => l10n('The original image quality must be a number between %d and %d'),
),
);
@@ -170,14 +96,14 @@ function save_upload_form_config($data, &$errors=array())
}
$updates[] = array(
- 'param' => 'upload_form_'.$field,
+ 'param' => $field,
'value' => boolean_to_string($value)
);
}
elseif ($upload_form_config[$field]['can_be_null'] and empty($value))
{
$updates[] = array(
- 'param' => 'upload_form_'.$field,
+ 'param' => $field,
'value' => 'false'
);
}
@@ -190,7 +116,7 @@ function save_upload_form_config($data, &$errors=array())
if (preg_match($pattern, $value) and $value >= $min and $value <= $max)
{
$updates[] = array(
- 'param' => 'upload_form_'.$field,
+ 'param' => $field,
'value' => $value
);
}
@@ -226,16 +152,11 @@ function save_upload_form_config($data, &$errors=array())
function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null, $image_id=null)
{
- // Here is the plan
- //
// 1) move uploaded file to upload/2010/01/22/20100122003814-449ada00.jpg
//
- // 2) if taller than max_height or wider than max_width, move to pwg_high
- // + web sized creation
- //
- // 3) thumbnail creation from web sized
+ // 2) keep/resize original
//
- // 4) register in database
+ // 3) register in database
// TODO
// * check md5sum (already exists?)
@@ -247,7 +168,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
if (isset($image_id))
{
- // we are performing an update
+ // this photo already exists, we update it
$query = '
SELECT
path
@@ -316,83 +237,35 @@ SELECT
copy($source_filepath, $file_path);
}
- if ($conf['upload_form_websize_resize']
- and need_resize($file_path, $conf['upload_form_websize_maxwidth'], $conf['upload_form_websize_maxheight']))
+ if (pwg_image::get_library() != 'gd')
{
- $high_path = file_path_for_type($file_path, 'high');
- $high_dir = dirname($high_path);
- prepare_directory($high_dir);
-
- rename($file_path, $high_path);
- $high_infos = pwg_image_infos($high_path);
-
- $img = new pwg_image($high_path);
-
- $img->pwg_resize(
- $file_path,
- $conf['upload_form_websize_maxwidth'],
- $conf['upload_form_websize_maxheight'],
- $conf['upload_form_websize_quality'],
- $conf['upload_form_automatic_rotation'],
- false
- );
-
- if ($img->library != 'gd')
+ if ($conf['original_resize'])
{
- if ($conf['upload_form_hd_keep'])
+ $need_resize = need_resize($file_path, $conf['original_resize_maxwidth'], $conf['original_resize_maxheight']);
+
+ if ($need_resize)
{
- if ($conf['upload_form_hd_resize'])
- {
- $need_resize = need_resize($high_path, $conf['upload_form_hd_maxwidth'], $conf['upload_form_hd_maxheight']);
+ $img = new pwg_image($file_path);
+
+ $img->pwg_resize(
+ $file_path,
+ $conf['original_resize_maxwidth'],
+ $conf['original_resize_maxheight'],
+ $conf['original_resize_quality'],
+ $conf['upload_form_automatic_rotation'],
+ false
+ );
- if ($need_resize)
- {
- $img->pwg_resize(
- $high_path,
- $conf['upload_form_hd_maxwidth'],
- $conf['upload_form_hd_maxheight'],
- $conf['upload_form_hd_quality'],
- $conf['upload_form_automatic_rotation'],
- false
- );
- $high_infos = pwg_image_infos($high_path);
- }
- }
- }
- else
- {
- unlink($high_path);
- $high_infos = null;
+ $img->destroy();
}
}
- $img->destroy();
}
$file_infos = pwg_image_infos($file_path);
- $thumb_path = file_path_for_type($file_path, 'thumb');
- $thumb_dir = dirname($thumb_path);
- prepare_directory($thumb_dir);
-
- $img = new pwg_image($file_path);
- $img->pwg_resize(
- $thumb_path,
- $conf['upload_form_thumb_maxwidth'],
- $conf['upload_form_thumb_maxheight'],
- $conf['upload_form_thumb_quality'],
- false,
- true,
- $conf['upload_form_thumb_crop'],
- $conf['upload_form_thumb_follow_orientation']
- );
- $img->destroy();
-
- $thumb_infos = pwg_image_infos($thumb_path);
-
if (isset($image_id))
{
$update = array(
- 'id' => $image_id,
'file' => pwg_db_real_escape_string(isset($original_filename) ? $original_filename : basename($file_path)),
'filesize' => $file_infos['filesize'],
'width' => $file_infos['width'],
@@ -401,33 +274,15 @@ SELECT
'added_by' => $user['id'],
);
- if (isset($high_infos))
- {
- $update['has_high'] = 'true';
- $update['high_filesize'] = $high_infos['filesize'];
- $update['high_width'] = $high_infos['width'];
- $update['high_height'] = $high_infos['height'];
- }
- else
- {
- $update['has_high'] = 'false';
- $update['high_filesize'] = null;
- $update['high_width'] = null;
- $update['high_height'] = null;
- }
-
if (isset($level))
{
$update['level'] = $level;
}
- mass_updates(
+ single_update(
IMAGES_TABLE,
- array(
- 'primary' => array('id'),
- 'update' => array_keys($update)
- ),
- array($update)
+ $update,
+ array('id' => $image_id)
);
}
else
@@ -457,12 +312,8 @@ SELECT
{
$insert['level'] = $level;
}
-
- mass_inserts(
- IMAGES_TABLE,
- array_keys($insert),
- array($insert)
- );
+
+ single_insert(IMAGES_TABLE, $insert);
$image_id = pwg_db_insert_id(IMAGES_TABLE);
}
diff --git a/admin/include/photos_add_direct_process.inc.php b/admin/include/photos_add_direct_process.inc.php
index c0cb3e4c0..03900747e 100644
--- a/admin/include/photos_add_direct_process.inc.php
+++ b/admin/include/photos_add_direct_process.inc.php
@@ -202,12 +202,7 @@ SELECT
$thumbnail['file'] = $image_infos['file'];
- $thumbnail['src'] = get_thumbnail_location(
- array(
- 'path' => $image_infos['path'],
- 'tn_ext' => $image_infos['tn_ext'],
- )
- );
+ $thumbnail['src'] = DerivativeImage::thumb_url($image_infos);
// TODO: when implementing this plugin in Piwigo core, we should have
// a function get_image_name($name, $file) (if name is null, then
diff --git a/admin/include/uploadify/uploadify.php b/admin/include/uploadify/uploadify.php
index d70e44635..cc30cf9e7 100644
--- a/admin/include/uploadify/uploadify.php
+++ b/admin/include/uploadify/uploadify.php
@@ -72,7 +72,7 @@ SELECT
;';
$image_infos = pwg_db_fetch_assoc(pwg_query($query));
-$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', get_thumbnail_url($image_infos));
+$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', DerivativeImage::thumb_url($image_infos));
$return = array(
'image_id' => $image_id,
diff --git a/admin/photos_add.php b/admin/photos_add.php
index 0b7053e64..d1962808a 100644
--- a/admin/photos_add.php
+++ b/admin/photos_add.php
@@ -56,10 +56,6 @@ $tabs = array(
'label' => l10n('Upload Photos'),
),
array(
- 'code' => 'settings',
- 'label' => l10n('Settings'),
- ),
- array(
'code' => 'ploader',
'label' => l10n('Piwigo Uploader'),
),
diff --git a/admin/photos_add_settings.php b/admin/photos_add_settings.php
deleted file mode 100644
index eebbec15c..000000000
--- a/admin/photos_add_settings.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2010 Pierrick LE GALL http://piwigo.org |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation |
-// | |
-// | This program is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA. |
-// +-----------------------------------------------------------------------+
-
-if (!defined('PHOTOS_ADD_BASE_URL'))
-{
- die ("Hacking attempt!");
-}
-
-// by default, the form values are the current configuration
-// we may overwrite them with the current form values
-$form_values = array();
-
-foreach ($upload_form_config as $param_shortname => $param)
-{
- $param_name = 'upload_form_'.$param_shortname;
- $form_values[$param_shortname] = $conf[$param_name];
-}
-
-// +-----------------------------------------------------------------------+
-// | process form |
-// +-----------------------------------------------------------------------+
-
-if (isset($_POST['submit']))
-{
- $updates = array();
-
- // let's care about the specific checkbox that disable/enable other
- // settings
- $field = 'websize_resize';
- $fields[] = $field;
-
- if (!empty($_POST[$field]))
- {
- $fields[] = 'websize_maxwidth';
- $fields[] = 'websize_maxheight';
- $fields[] = 'websize_quality';
- }
-
- // hd_keep
- $field = 'hd_keep';
- $fields[] = $field;
-
- if (!empty($_POST[$field]))
- {
- $field = 'hd_resize';
- $fields[] = $field;
-
- if (!empty($_POST[$field]))
- {
- $fields[] = 'hd_maxwidth';
- $fields[] = 'hd_maxheight';
- $fields[] = 'hd_quality';
- }
- }
-
- // and now other fields, processed in a generic way
- $fields[] = 'thumb_maxwidth';
- $fields[] = 'thumb_maxheight';
- $fields[] = 'thumb_quality';
- $fields[] = 'thumb_crop';
- $fields[] = 'thumb_follow_orientation';
-
- 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')
- );
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | template init |
-// +-----------------------------------------------------------------------+
-
-foreach (array_keys($upload_form_config) as $field)
-{
- if (is_bool($upload_form_config[$field]['default']))
- {
- $form_values[$field] = $form_values[$field] ? 'checked="checked"' : '';
- }
-}
-
-$template->assign(
- array(
- 'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
- 'MANAGE_HD' => pwg_image::get_library() != 'gd',
- 'values' => $form_values
- )
- );
-
-
-// +-----------------------------------------------------------------------+
-// | sending html code |
-// +-----------------------------------------------------------------------+
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'photos_add');
-?> \ No newline at end of file
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl
index 59ab62006..008dfe4e0 100644
--- a/admin/themes/default/template/configuration.tpl
+++ b/admin/themes/default/template/configuration.tpl
@@ -247,6 +247,52 @@ jQuery(document).ready(function () {
</div> <!-- configContent -->
+{if isset($sizes)}
+
+{footer_script}{literal}
+jQuery(document).ready(function(){
+ function toggleResizeFields(prefix) {
+ var checkbox = jQuery("#"+prefix+"_resize");
+ var needToggle = jQuery("input[name^="+prefix+"_]").not(checkbox).parents('tr');
+
+ if (jQuery(checkbox).is(':checked')) {
+ needToggle.show();
+ }
+ else {
+ needToggle.hide();
+ }
+ }
+
+ toggleResizeFields("original");
+ jQuery("#original_resize").click(function () {toggleResizeFields("original")});
+});
+{/literal}{/footer_script}
+
+<fieldset id="sizesConf">
+ <legend>{'Original Size'|@translate}</legend>
+
+ <table>
+ <tr>
+ <th><label for="original_resize">{'Resize after upload'|@translate}</label></th>
+ <td><input type="checkbox" name="original_resize" id="original_resize" {if ($sizes.original_resize)}checked="checked"{/if}></td>
+ </tr>
+ <tr>
+ <th>{'Maximum Width'|@translate}</th>
+ <td><input type="text" name="original_resize_maxwidth" value="{$sizes.original_resize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
+ </tr>
+ <tr>
+ <th>{'Maximum Height'|@translate}</th>
+ <td><input type="text" name="original_resize_maxheight" value="{$sizes.original_resize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
+ </tr>
+ <tr>
+ <th>{'Image Quality'|@translate}</th>
+ <td><input type="text" name="original_resize_quality" value="{$sizes.original_resize_quality}" size="3" maxlength="3"> %</td>
+ </tr>
+ </table>
+
+</fieldset>
+{/if}
+
{if isset($default)}
{$PROFILE_CONTENT}
{/if}
@@ -445,7 +491,7 @@ jQuery(document).ready(function () {
{if !isset($default)}
<p>
- <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}">
+ <input class="submit" type="submit" name="submit" value="{'Save Settings'|@translate}">
<input class="submit" type="reset" name="reset" value="{'Reset'|@translate}">
</p>
</form>
diff --git a/admin/themes/default/template/photos_add_settings.tpl b/admin/themes/default/template/photos_add_settings.tpl
deleted file mode 100644
index 3180ac024..000000000
--- a/admin/themes/default/template/photos_add_settings.tpl
+++ /dev/null
@@ -1,163 +0,0 @@
-{footer_script}
-var width = '{'Width'|@translate}';
-var height = '{'Height'|@translate}';
-var max_width = '{'Maximum Width'|@translate}';
-var max_height = '{'Maximum Height'|@translate}';
-
-{literal}
-jQuery(document).ready(function(){
- function toggleResizeFields(prefix) {
- var checkbox = jQuery("#"+prefix+"_resize");
- var needToggle = jQuery("input[name^="+prefix+"_]").not(checkbox).not(jQuery("#hd_keep")).parents('tr');
-
- if (jQuery(checkbox).is(':checked')) {
- needToggle.show();
-
- if (prefix == "websize") {
- jQuery("#hd_keep").parents("fieldset").show();
- }
- }
- else {
- needToggle.hide();
-
- if (prefix == "websize") {
- jQuery("#hd_keep").parents("fieldset").hide();
- }
- }
- }
-
- function toggleCropFields(prefix) {
- if (jQuery("#"+prefix+"_crop").is(':checked')) {
- jQuery("#"+prefix+"_width_th").text(width);
- jQuery("#"+prefix+"_height_th").text(height);
- jQuery("#"+prefix+"_follow_orientation_tr").show();
- }
- else {
- jQuery("#"+prefix+"_width_th").text(max_width);
- jQuery("#"+prefix+"_height_th").text(max_height);
- jQuery("#"+prefix+"_follow_orientation_tr").hide();
- }
-
- }
-
- toggleResizeFields("websize");
- jQuery("#websize_resize").click(function () {toggleResizeFields("websize")});
-
- toggleResizeFields("hd");
- jQuery("#hd_resize").click(function () {toggleResizeFields("hd")});
-
- toggleCropFields("thumb");
- jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")});
-
- function toggleHdFields() {
- var checkbox = jQuery("#hd_keep");
- var needToggle = jQuery("input[name^=hd_]").not(checkbox).parents('tr');
-
- if (jQuery(checkbox).is(':checked')) {
- needToggle.show();
- toggleResizeFields("hd");
- }
- else {
- needToggle.hide();
- }
- }
-
- toggleHdFields();
- jQuery("#hd_keep").click(function () {toggleHdFields()});
-});
-{/literal}{/footer_script}
-
-<div class="titrePage">
- <h2>{'Upload Photos'|@translate}</h2>
-</div>
-
-<div id="photosAddContent">
-
-<form id="uploadFormSettings" enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties">
-
- <fieldset>
- <legend>{'Web size photo'|@translate}</legend>
-
- <table>
- <tr>
- <th><label for="websize_resize">{'Resize'|@translate}</label></th>
- <td><input type="checkbox" name="websize_resize" id="websize_resize" {$values.websize_resize}></td>
- </tr>
- <tr>
- <th>{'Maximum Width'|@translate}</th>
- <td><input type="text" name="websize_maxwidth" value="{$values.websize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Maximum Height'|@translate}</th>
- <td><input type="text" name="websize_maxheight" value="{$values.websize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Image Quality'|@translate}</th>
- <td><input type="text" name="websize_quality" value="{$values.websize_quality}" size="3" maxlength="3"> %</td>
- </tr>
- </table>
- </fieldset>
-
- <fieldset>
- <legend>{'Thumbnail'|@translate}</legend>
-
- <table>
- <tr>
- <th><label for="thumb_crop">{'Crop'|@translate}</label></th>
- <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {$values.thumb_crop}></td>
- </tr>
- <tr id="thumb_follow_orientation_tr">
- <th><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></th>
- <td><input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {$values.thumb_follow_orientation}></td>
- </tr>
- <tr>
- <th id="thumb_width_th">{'Maximum Width'|@translate}</th>
- <td><input type="text" name="thumb_maxwidth" value="{$values.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th id="thumb_height_th">{'Maximum Height'|@translate}</th>
- <td><input type="text" name="thumb_maxheight" value="{$values.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Image Quality'|@translate}</th>
- <td><input type="text" name="thumb_quality" value="{$values.thumb_quality}" size="3" maxlength="3"> %</td>
- </tr>
- </table>
- </fieldset>
-
-{if $MANAGE_HD}
- <fieldset>
- <legend>{'High definition'|@translate}</legend>
-
- <table>
- <tr>
- <th><label for="hd_keep">{'Keep high definition'|@translate}</label></th>
- <td><input type="checkbox" name="hd_keep" id="hd_keep" {$values.hd_keep}></td>
- </tr>
- <tr>
- <th><label for="hd_resize">{'Resize'|@translate}</label></th>
- <td><input type="checkbox" name="hd_resize" id="hd_resize" {$values.hd_resize}></td>
- </tr>
- <tr>
- <th>{'Maximum Width'|@translate}</th>
- <td><input type="text" name="hd_maxwidth" value="{$values.hd_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Maximum Height'|@translate}</th>
- <td><input type="text" name="hd_maxheight" value="{$values.hd_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Image Quality'|@translate}</th>
- <td><input type="text" name="hd_quality" value="{$values.hd_quality}" size="3" maxlength="3"> %</td>
- </tr>
- </table>
- </fieldset>
-{/if}
-
- <p>
- <input class="submit" type="submit" name="submit" value="{'Save Settings'|@translate}"/>
- </p>
-
-</form>
-
-</div> <!-- photosAddContent -->