Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.40
diff -u -p -r1.40 image.inc
--- includes/image.inc	16 Jul 2010 02:39:38 -0000	1.40
+++ includes/image.inc	5 Aug 2010 23:53:31 -0000
@@ -165,8 +165,13 @@ function image_get_info($filepath, $tool
  * @see image_resize()
  * @see image_crop()
  */
-function image_scale_and_crop(stdClass $image, $width, $height) {
+function image_scale_and_crop(stdClass $image, $width, $height, $upscale = TRUE) {
   $scale = max($width / $image->info['width'], $height / $image->info['height']);
+  if (!$upscale && $scale >= 1.0) {
+    $width = $width / $scale;
+    $height = $height / $scale;
+    $scale = 1.0;
+  }
   $x = ($image->info['width'] * $scale - $width) / 2;
   $y = ($image->info['height'] * $scale - $height) / 2;
 
Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.21
diff -u -p -r1.21 image.admin.inc
--- modules/image/image.admin.inc	30 Jul 2010 02:47:28 -0000	1.21
+++ modules/image/image.admin.inc	5 Aug 2010 23:53:37 -0000
@@ -548,6 +548,27 @@ function image_scale_form($data) {
 }
 
 /**
+ * Form structure for the image scale and crop form.
+ *
+ * Note that this is not a complete form, it only contains the portion of the
+ * form for configuring the scale and crop options. Therefore it does not not
+ * need to include metadata about the effect, nor a submit button.
+ *
+ * @param $data
+ *   The current configuration for this scale and crop effect.
+ */
+function image_scale_and_crop_form($data) {
+  $form = image_resize_form($data);
+  $form['upscale'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => (isset($data['upscale'])) ? $data['upscale'] : TRUE,
+    '#title' => t('Allow Upscaling'),
+    '#description' => t('Let scale make images larger than their original size'),
+  );
+  return $form;
+}
+
+/**
  * Form structure for the image crop form.
  *
  * Note that this is not a complete form, it only contains the portion of the
@@ -876,6 +897,23 @@ function theme_image_scale_summary($vari
 }
 
 /**
+ * Returns HTML for a summary of an image scale and crop effect.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this scale and crop effect.
+ *
+ * @ingroup themeable
+ */
+function theme_image_scale_and_crop_summary($variables) {
+  $data = $variables['data'];
+  if (!isset($data['upscale'])) {
+    $data['upscale'] = TRUE;
+  }
+  return theme('image_resize_summary', array('data' => $data)) . ' ' . ($data['upscale'] ? '(' . t('upscaling allowed') . ')' : '');
+}
+
+/**
  * Returns HTML for a summary of an image crop effect.
  *
  * @param $variables
Index: modules/image/image.effects.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.effects.inc,v
retrieving revision 1.5
diff -u -p -r1.5 image.effects.inc
--- modules/image/image.effects.inc	6 May 2010 05:59:31 -0000	1.5
+++ modules/image/image.effects.inc	5 Aug 2010 23:53:37 -0000
@@ -29,8 +29,8 @@ function image_image_effect_info() {
       'label' => t('Scale and crop'),
       'help' => t('Scale and crop will maintain the aspect-ratio of the original image, then crop the larger dimension. This is most useful for creating perfectly square thumbnails without stretching the image.'),
       'effect callback' => 'image_scale_and_crop_effect',
-      'form callback' => 'image_resize_form',
-      'summary theme' => 'image_resize_summary',
+      'form callback' => 'image_scale_and_crop_form',
+      'summary theme' => 'image_scale_and_crop_summary',
     ),
     'image_crop' => array(
       'label' => t('Crop'),
@@ -159,12 +159,18 @@ function image_crop_effect(&$image, $dat
  *   with the following items:
  *   - "width": An integer representing the desired width in pixels.
  *   - "height": An integer representing the desired height in pixels.
+ *   - "upscale": (optional) A Boolean indicating that the image should be
+ *     upscalled if the dimensions are larger than the original image. Defaults
+ *     to TRUE.
  * @return
  *   TRUE on success. FALSE on failure to scale and crop image.
  * @see image_scale_and_crop()
  */
 function image_scale_and_crop_effect(&$image, $data) {
-  if (!image_scale_and_crop($image, $data['width'], $data['height'])) {
+  if (!isset($data['upscale'])) {
+    $data['upscale'] = TRUE;
+  }
+  if (!image_scale_and_crop($image, $data['width'], $data['height'], $data['upscale'])) {
     watchdog('image', 'Image scale and crop failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', array('%toolkit' => $image->toolkit, '%path' => $image->source, '%mimetype' => $image->info['mime_type'], '%dimensions' => $image->info['height'] . 'x' . $image->info['height']), WATCHDOG_ERROR);
     return FALSE;
   }
Index: modules/image/image.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.module,v
retrieving revision 1.44
diff -u -p -r1.44 image.module
--- modules/image/image.module	30 Jul 2010 01:37:54 -0000	1.44
+++ modules/image/image.module	5 Aug 2010 23:53:37 -0000
@@ -203,6 +203,9 @@ function image_theme() {
     'image_scale_summary' => array(
       'variables' => array('data' => NULL),
     ),
+    'image_scale_and_crop_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
     'image_crop_summary' => array(
       'variables' => array('data' => NULL),
     ),
