### Eclipse Workspace Patch 1.0
#P contrib-modules
Index: image_exact/image_exact.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_exact/image_exact.module,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 image_exact.module
--- image_exact/image_exact.module	26 Jun 2006 19:04:34 -0000	1.3.2.2
+++ image_exact/image_exact.module	12 Aug 2006 07:15:15 -0000
@@ -36,12 +36,12 @@
       '#description' => t('If checked, this will force images of the size(s) checked below (as defined on the %link) to be exactly the size specified. Otherwise, the settings below will be ignored.', array('%link' => $image_settings)),
     );
     foreach (_image_get_sizes() as $count => $size) {
-      $options[$count] = $size['label'];
+      $options['size-'. $count] = $size['label'];
     }
     $form['image_exact_nodes']['image_exact_size'] = array(
       '#type' => 'checkboxes',
       '#title' => t('Specific Image Size Settings'),
-      '#default_value' => variable_get('image_exact_size', array(0)),
+      '#default_value' => variable_get('image_exact_size', array('size-0')),
       '#options' => $options,
       '#description' => t('Each image size checked will be cropped and resized to the specified size defined in the %link. Note that existing images will not be resized until viewing that specific image edit tab, and possibly refreshing the browser.', array('%link' => $image_settings)),
     );
@@ -75,14 +75,16 @@
   //Set thumbnail final dimensions here - use settings from image content type.
   if ($node->type == 'image' && $op == 'validate' && variable_get('image_exact_thumbs', 1)) {
     $sizes = _image_get_sizes();
-    foreach(variable_get('image_exact_size', array(0)) as $i) {
-//     for ($i = 0; $i < 5; $i++) {
-      $source = file_create_path($node->images['_original']);
-      $destination = file_create_path($node->images[$sizes[$i]['label']]);
-      $final_w = $sizes[$i]['width'];
-      $final_h = $sizes[$i]['height'];
-      if ($final_w && $final_h) {
-        image_exact_resize($source, $destination, $final_w, $final_h);
+    foreach(variable_get('image_exact_size', array('size-0')) as $i) {
+      if($i){ // unchecked options return 0
+        $i = str_replace('size-', '', $i);
+        $source = file_create_path($node->images['_original']);
+        $destination = file_create_path($node->images[$sizes[$i]['label']]);
+        $final_w = $sizes[$i]['width'];
+        $final_h = $sizes[$i]['height'];
+        if ($final_w && $final_h && $node->images['_original']) {
+          image_exact_resize($source, $destination, $final_w, $final_h);
+        }
       }
     }
   }
@@ -103,7 +105,7 @@
 }
 
 function image_exact_resize($source, $destination, $final_w, $final_h) {
-  if (file_exists($source)) {
+  if (is_file($source)) {
     $source_info = image_get_info($source);
     $source_ar = $source_info['width'] / $source_info['height'];
     if ($source_info['width'] > $final_w && $source_info['height'] > $final_h) {
@@ -128,10 +130,10 @@
     image_resize($destination, $destination, $final_w, $final_h);
     // drupal_set_message("Resize: $final_w, $final_h",'message');
     if(!file_exists($destination)) {
-      drupal_set_message("Image_exact: Image resize failed.","error");
+      drupal_set_message(t("Image_exact: Image resize failed."),"error");
     }
   } else {
-    drupal_set_message('image_exact: File does not exist.','error');
+    drupal_set_message(t('image_exact: File does not exist.'),'error');
   }
 }
 ?>
