? .image.install.swp
? .image.module.swp
? image.patch
? project_150485.patch
? test.patch
Index: image.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/Attic/image.install,v
retrieving revision 1.1.4.7
diff -u -r1.1.4.7 image.install
--- image.install	7 Jul 2007 20:29:53 -0000	1.1.4.7
+++ image.install	13 Jul 2007 17:58:30 -0000
@@ -45,9 +45,9 @@
   if ($sizes) {
     $new_sizes = array(IMAGE_ORIGINAL => array('width' => '', 'height' => '', 'label' => t('Original')));
     foreach ($sizes as $size) {
-      $label = $size['label'];
-      $new_sizes[$label] = $size;
-      $new_sizes[$label]['label'] = drupal_ucfirst($label);
+      $key = drupal_strtolower($size['label']);
+      $size['label'] = drupal_ucfirst($size['label']);
+      $new_sizes[$key] = $size;
     }
     variable_set('image_sizes', $new_sizes);
   }
@@ -107,3 +107,39 @@
 
   return $ret;
 }
+
+/**
+ * Make sure that everyone's size settings are in the right format.
+ */
+function image_update_5() {
+  if ($old_sizes = variable_get('image_sizes', FALSE)) {
+    // Make sure all the required sizes are represented.
+    if (!isset($old_sizes[IMAGE_ORIGINAL])) {
+      drupal_set_message(t("The original image size was missing so no changes were made. See this <a href='!link'>image module issue</a> for more information. Include the following:<br /><pre>@old_sizes\n</pre>", array('!link' => url('http://drupal.org/node/158334'), '@old_sizes' => print_r($old_sizes, 1))), 'error');
+      return array();
+    }
+    // These sizes may already exist under incorrect keys. We'll put a default
+    // copy in that will either be overwritten by the existing version, or used
+    // if there isn't an existing version.
+    if (!isset($old_sizes[IMAGE_PREVIEW])) {
+      $old_sizes[IMAGE_PREVIEW] = array('width' => 640, 'height' => 640, 'label' => t('Preview'), 'link' => IMAGE_LINK_SHOWN);
+    }
+    if (!isset($old_sizes[IMAGE_THUMBNAIL])) {
+      $old_sizes[IMAGE_THUMBNAIL] = array('width' => 100, 'height' => 100, 'label' => t('Thumbnail'), 'link' => IMAGE_LINK_SHOWN);
+    }
+
+    $new_sizes = array();
+    foreach ($old_sizes as $old_key => $size) {
+      // Keys should be lowercase and less than 32 chars long.
+      $new_key = drupal_strtolower(drupal_substr($old_key, 0, 32));
+      // Update the files.
+      if ($new_key != $old_key) {
+        db_query("UPDATE {files} f INNER JOIN {node} n ON f.nid = n.nid SET f.filename = '%s' WHERE n.type = 'image' AND filename = '%s'", $new_key, $old_key);
+      }
+      $new_sizes[$new_key] = $size;
+    }
+    // Save the sizes.
+    variable_set('image_sizes', $new_sizes);
+  }
+  return array();
+}
Index: image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/Attic/image.module,v
retrieving revision 1.209.2.37
diff -u -r1.209.2.37 image.module
--- image.module	10 Jul 2007 23:08:33 -0000	1.209.2.37
+++ image.module	13 Jul 2007 17:48:54 -0000
@@ -197,7 +197,8 @@
     // Set a key for new rows.
     else if ($value['new']) {
       unset($form_values['image_sizes'][$key]);
-      $form_values['image_sizes'][$value['label']] = $value;
+      $new_key = drupal_strtolower(drupal_substr($value['label'], 0, 32));
+      $form_values['image_sizes'][$new_key] = $value;
     }
   }
   return system_settings_form_submit($form_id, $form_values);
