--- /Users/AshenRayne/Desktop/imagefield_focus/imagefield_focus_imagecache_actions.inc	2011-01-12 15:02:50.000000000 -0600
+++ /Users/AshenRayne/Desktop/imagefield_focus_imagecache_actions.inc	2011-01-13 13:00:36.000000000 -0600
@@ -33,6 +33,11 @@ function imagefield_focus_scale_and_crop
     ),
     '#default_value' => isset($data['strength']) ? $data['strength'] : 'high',
   );
+  $form['maintain'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Maintain crop size'),
+    '#default_value' => isset($data['maintain']) ? $data['maintain'] : 0,
+  );
   return $form;
 }
 
@@ -71,6 +76,30 @@ function imagefield_focus_scale_and_crop
       }
       $width0 = $image->info['width'] * $scale;
       $height0 = $image->info['height'] * $scale;
+      
+      if($data['maintain']){
+	      $diff_width = $data['width'] - $width0;
+	      $diff_height = $data['height'] - $height0;
+	      
+	      if($width0 < $data['width']){
+	      	$diff = $data['width'] - $width0;
+	      	$per_change = ($diff / $width0);
+	      	$width0 += $diff;
+	      	$height0 = ($height0 * $per_change) + $height0;
+	      	if($diff_height < $diff_width){
+	      		$rect['yoffset'] = (($image->info['height'] * $per_change) / 2) + $rect['yoffset'];
+	      	}
+	      }elseif($height0 < $data['height']){
+	      	$diff = $data['height'] - $height0;
+	      	$per_change = ($diff / $height0);
+	      	$height0 += $diff;
+	      	$width0 = ($width0 * $per_change) + $width0;
+	      	if($diff_width < $diff_height){
+	      		$rect['xoffset'] = (($image->info['width'] * $per_change) / 2) + $rect['xoffset'];
+	      	}
+	      }
+      }
+      
       if (($scale < 1) && !imagecache_resize_image($image, array('width' => $width0, 'height' => $height0))) {
         return FALSE;
       }
