? .DS_Store
? _PATCHES
? image-HEAD.derivative-rebuild.patch
? rebuild-image_attach-fix-226121.patch
? skip-rebuild-paths-image-HEAD-226121.patch
? content_types/.DS_Store
? contrib/.DS_Store
? contrib/image_gallery/.DS_Store
? tests/.DS_Store
Index: image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.316
diff -u -p -r1.316 image.module
--- image.module	26 Aug 2009 14:42:04 -0000	1.316
+++ image.module	26 Aug 2009 14:49:40 -0000
@@ -476,6 +476,16 @@ function image_load(&$node) {
     // There's no original image, we're in trouble...
     return;
   }
+  
+  if ((arg(0) != 'batch') || (strpos($_GET['q'], 'admin/content/node') === FALSE)) {
+    _image_build_derivatives_if_needed($node);
+  }
+}
+  
+/**
+ * Rebuild derivatives if needed. Helper function for image_load(). 
+ */
+function _image_build_derivatives_if_needed(&$node) {
   $node->rebuild_images = FALSE;
 
   // Figure out which sizes should have been generated.
@@ -512,6 +522,8 @@ function image_load(&$node) {
 
   // Correct any problems with the derivative images.
   if ($node->rebuild_images) {
+    // Possibly TODO: calling a hook implementation here isn't very elegant.
+    // but the code there is tangled and it works, so maybe leave it ;)    
     image_update($node);
     watchdog('image', 'Derivative images were regenerated for %title.', array('%title' => $node->title), WATCHDOG_INFO, l(t('view'), 'node/'. $node->nid));
   }
