Index: trunk/admin/batch_manager_global.php
===================================================================
--- trunk/admin/batch_manager_global.php	(revision 10552)
+++ trunk/admin/batch_manager_global.php	(revision 10553)
@@ -418,5 +418,5 @@
       array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError']));
 
-    $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality');
+    $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality', 'thumb_crop', 'thumb_follow_orientation');
   }
 
@@ -438,24 +438,36 @@
     foreach ($update_fields as $field)
     {
-      $value = null;
-      if (!empty($_POST[$field]))
+      if (is_bool($upload_form_config[$field]['default']))
       {
-        $value = $_POST[$field];
-      }
-
-      if (preg_match($upload_form_config[$field]['pattern'], $value)
-        and $value >= $upload_form_config[$field]['min']
-        and $value <= $upload_form_config[$field]['max'])
-      {
-        $conf['upload_form_'.$field] = $value;
-         $updates[] = array(
+        $value = isset($_POST[$field]);
+
+        $updates[] = array(
           'param' => 'upload_form_'.$field,
-          'value' => $value
+          'value' => boolean_to_string($value)
           );
       }
       else
       {
-        $updates = null;
-        break;
+        $value = null;
+        if (!empty($_POST[$field]))
+        {
+          $value = $_POST[$field];
+        }
+
+        if (preg_match($upload_form_config[$field]['pattern'], $value)
+          and $value >= $upload_form_config[$field]['min']
+          and $value <= $upload_form_config[$field]['max'])
+        {
+          $conf['upload_form_'.$field] = $value;
+           $updates[] = array(
+            'param' => 'upload_form_'.$field,
+            'value' => $value
+            );
+        }
+        else
+        {
+          $updates = null;
+          break;
+        }
       }
       $form_values[$field] = $value;
Index: trunk/admin/themes/default/template/batch_manager_global.tpl
===================================================================
--- trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 10552)
+++ trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 10553)
@@ -37,4 +37,9 @@
 var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}";
 var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}";
+
+var width_str = '{'Width'|@translate}';
+var height_str = '{'Height'|@translate}';
+var max_width_str = '{'Maximum Width'|@translate}';
+var max_height_str = '{'Maximum Height'|@translate}';
 {literal}
 function str_repeat(i, m) {
@@ -334,4 +339,6 @@
       maxheight = jQuery('input[name="thumb_maxheight"]').val();
       regenerationText = regenerateThumbnailsMessage;
+      crop = jQuery('input[name="thumb_crop"]').is(':checked');
+      follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked');
     }
     else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize')
@@ -342,4 +349,6 @@
       maxheight = jQuery('input[name="websize_maxheight"]').val();
       regenerationText = regenerateWebsizeMessage;
+      crop = false;
+      follow_orientation = false;
     }
     else return true;
@@ -386,4 +395,6 @@
           maxwidth: maxwidth,
           maxheight: maxheight,
+          crop: crop,
+          follow_orientation: follow_orientation,
           image_id: elements[i],
           format: 'json'
@@ -396,4 +407,20 @@
     return false;
   });
+
+  function toggleCropFields(prefix) {
+    if (jQuery("#"+prefix+"_crop").is(':checked')) {
+      jQuery("#"+prefix+"_width_th").text(width_str);
+      jQuery("#"+prefix+"_height_th").text(height_str);
+      jQuery("#"+prefix+"_follow_orientation_tr").show();
+    }
+    else {
+      jQuery("#"+prefix+"_width_th").text(max_width_str);
+      jQuery("#"+prefix+"_height_th").text(max_height_str);
+      jQuery("#"+prefix+"_follow_orientation_tr").hide();
+    }
+  }
+
+  toggleCropFields("thumb");
+  jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")});
 
   checkPermitAction()
@@ -662,9 +689,17 @@
       <table style="margin-left:20px;">
         <tr>
-          <th>{'Maximum Width'|@translate}</th>
+          <th><label for="thumb_crop">{'Crop'|@translate}</label></th>
+          <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></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" {if $upload_form_settings.thumb_follow_orientation}checked="checked"{/if}></td>
+        </tr>
+        <tr>
+          <th id="thumb_width_th">{'Maximum Width'|@translate}</th>
           <td><input type="text" name="thumb_maxwidth" value="{$upload_form_settings.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
         </tr>
         <tr>
-          <th>{'Maximum Height'|@translate}</th>
+          <th id="thumb_height_th">{'Maximum Height'|@translate}</th>
           <td><input type="text" name="thumb_maxheight" value="{$upload_form_settings.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
         </tr>
Index: trunk/include/ws_functions.inc.php
===================================================================
--- trunk/include/ws_functions.inc.php	(revision 10552)
+++ trunk/include/ws_functions.inc.php	(revision 10553)
@@ -2674,9 +2674,9 @@
   }
 
-  $resize_params = array('maxwidth', 'maxheight', 'quality');
+  $resize_params = array('maxwidth', 'maxheight', 'quality', 'crop', 'follow_orientation');
   $type = $params['type'] == 'thumbnail' ? 'thumb' : 'websize';
   foreach ($resize_params as $param)
   {
-    if (empty($params[$param]))
+    if (empty($params[$param]) and isset($conf['upload_form_'.$type.'_'.$param]))
       $params[$param] = $conf['upload_form_'.$type.'_'.$param];
   }
@@ -2711,5 +2711,7 @@
       $params['maxheight'],
       $params['quality'],
-      true
+      true,
+      get_boolean($params['crop']),
+      get_boolean($params['follow_orientation'])
     );
     return true;
Index: trunk/ws.php
===================================================================
--- trunk/ws.php	(revision 10552)
+++ trunk/ws.php	(revision 10553)
@@ -413,9 +413,11 @@
       'maxwidth' => array('default' => null),
       'maxheight' => array('default' => null),
+      'crop' => array('default' => null),
+      'follow_orientation' => array('default' => null),
       'quality' => array('default' => null),
     ),
     'Regenerate thumbnails or websize photo with given arguments.
 <br>Argument "type" can be "thumbnail" or "websize". Default is "thumbnail".
-<br>If maxwidth, maxheight or quality are missing, default parameters of upload will be used.'
+<br>If maxwidth, maxheight, crop, follow_orientation or quality are missing, default parameters of upload will be used.'
 );
 
