Index: imagefield_crop.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield_crop/imagefield_crop.module,v
retrieving revision 1.1.2.11.2.5
diff -u -p -r1.1.2.11.2.5 imagefield_crop.module
--- imagefield_crop.module	11 Nov 2009 08:12:53 -0000	1.1.2.11.2.5
+++ imagefield_crop.module	14 Sep 2010 13:15:22 -0000
@@ -96,6 +96,7 @@ function imagefield_crop_theme() {
       'arguments' => array(
         'file' => NULL,
         'resolution' => 0,
+        'preview_width' => 0,
       ),
     ),
     // display admin preview
Index: imagefield_crop_widget.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield_crop/Attic/imagefield_crop_widget.inc,v
retrieving revision 1.1.2.20
diff -u -p -r1.1.2.20 imagefield_crop_widget.inc
--- imagefield_crop_widget.inc	30 May 2010 15:01:10 -0000	1.1.2.20
+++ imagefield_crop_widget.inc	14 Sep 2010 13:15:22 -0000
@@ -41,7 +41,15 @@ function imagefield_crop_widget_settings
     '#description' => t('The resolution of the area used for the cropping of the image. Image will displayed at this resolution for cropping. Use WIDTHxHEIGHT format, zero values are permitted, e.g. 500x0 will limit crop box to 500 pixels width.'),
     '#element_validate' => array('_imagefield_crop_widget_settings_croparea_validate'),
   );
-  
+  $form['preview_width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('The maximum width of the preview area'),
+    '#default_value' => isset($widget['preview_width']) ? $widget['preview_width'] : '500',
+    '#size' => 15,
+    '#maxlength' => 10,
+    '#description' => t('The width entered here will restrain the with of the preview area. Use 0 if you\'d prefer no maximum width.'),
+    '#element_validate' => array('_imagefield_crop_widget_settings_preview_width_validate'),
+  );
   return $form;
 }
 
@@ -92,12 +100,18 @@ function _imagefield_crop_widget_setting
   }
 }
 
+function _imagefield_crop_widget_settings_preview_width_validate($element, &$form_state) {
+  if (!is_numeric($form_state['values']['preview_width'])) {
+    form_error($element, t('Preview width must be an integer'));
+  }
+}
+
 function imagefield_crop_widget_settings_validate($widget) {
   module_invoke('imagefield', 'widget_settings_validate', $widget);
 }
 
 function imagefield_crop_widget_settings_save($widget) {
-  $settings = array('resolution', 'enforce_ratio', 'croparea', 'enforce_minimum');
+  $settings = array('resolution', 'enforce_ratio', 'croparea', 'enforce_minimum', 'preview_width');
   return array_merge($settings, module_invoke('imagefield', 'widget_settings_save', $widget));
 }
 
@@ -199,7 +213,7 @@ function imagefield_crop_widget_process(
   }
   
   // show dynamic crop preview
-  list($preview, $preview_js) = theme('imagefield_crop_dynamic_preview', $crop_display, $field['widget']['resolution']);
+  list($preview, $preview_js) = theme('imagefield_crop_dynamic_preview', $crop_display, $field['widget']['resolution'], $field['widget']['preview_width']);
 
   if (!isset($added_js[$element['#id']])) {
     // Add settings only once (for ahah).
@@ -269,13 +283,18 @@ function theme_imagefield_crop_cropbox($
 }
 
 
-function theme_imagefield_crop_dynamic_preview($file, $resolution) {
+function theme_imagefield_crop_dynamic_preview($file, $resolution, $preview_width = 0) {
   $file = (array)$file;
   if (!is_file($file['filepath'])) {
     return array('<!-- file not found: '. $file['filepath'] .' -->', '');
   }
   list($width, $height) = explode('x', $resolution);
   
+  if ($preview_width) {
+    $height = round($height / ($width / $preview_width));
+    $width = $preview_width;
+  }
+
   $image_attributes = array();
   if (list($orig_width, $orig_height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
     $alt = $file['alt'] ? $alt : 'jcrop preview';
