=== modified file 'uc_cart/uc_cart.module'
--- uc_cart/uc_cart.module	2009-08-17 21:21:34 +0000
+++ uc_cart/uc_cart.module	2009-08-18 21:22:38 +0000
@@ -175,34 +175,28 @@
 }
 
 /**
- * Implementation of hook_enable().
+ * Implementation of hook_imagecache_default_presets().
  */
-function uc_cart_enable() {
-  // Create an Imagecache preset for the cart view form.
-  if (module_exists('imagecache')) {
-    $preset_name = 'cart';
-    $preset = imagecache_preset_by_name($preset_name);
-    if (empty($preset)) {
-      // No preset of that name, so make a new one.
-      $preset = imagecache_preset_save(array('presetname' => $preset_name));
-    }
+function uc_cart_imagecache_default_presets() {
+  $presets = array();
 
-    $actions = imagecache_preset_actions($preset);
-    if (empty($actions)) {
-      // The preset has no actions, so scale the image.
-      $action = array(
+  $presets['cart'] = array(
+    'presetname' => 'cart',
+    'actions' => array(
+      array(
+        'weight' => '0',
+        'module' => 'uc_cart',
         'action' => 'imagecache_scale',
-        'presetid' => $preset['presetid'],
-        'weight' => 0,
         'data' => array(
           'width' => '50',
           'height' => '50',
           'upscale' => 0,
         ),
-      );
-      imagecache_action_save($action);
-    }
-  }
+      ),
+    ),
+  );
+
+  return $presets;
 }
 
 /**

=== modified file 'uc_catalog/uc_catalog.module'
--- uc_catalog/uc_catalog.module	2009-08-14 19:10:32 +0000
+++ uc_catalog/uc_catalog.module	2009-08-18 21:21:53 +0000
@@ -139,36 +139,34 @@
  * Add imagecache preset "uc_category".
  */
 function uc_catalog_enable() {
-  if (module_exists('imagecache')) {
-    $preset_name = 'uc_category';
-    $preset = imagecache_preset_by_name($preset_name);
-
-    if (empty($preset)) {
-      // No preset of that name, so make a new one.
-      $preset = imagecache_preset_save(array('presetname' => $preset_name));
-    }
-
-    $actions = imagecache_preset_actions($preset);
-
-    if (empty($actions)) {
-      // The preset has no actions, so scale the image.
-      $action = array(
+  foreach (uc_product_types() as $type) {
+    uc_catalog_add_node_type($type);
+  }
+}
+
+/**
+ * Implementation of hook_imagecache_default_presets().
+ */
+function uc_catalog_imagecache_default_presets() {
+  $presets = array();
+
+  $presets['uc_category'] = array(
+    'presetname' => 'uc_category',
+    'actions' => array(
+      array(
+        'weight' => '0',
+        'module' => 'uc_category',
         'action' => 'imagecache_scale',
-        'presetid' => $preset['presetid'],
-        'weight' => 0,
         'data' => array(
           'width' => '100',
           'height' => '100',
           'upscale' => 0,
         ),
-      );
-      imagecache_action_save($action);
-    }
-  }
+      ),
+    ),
+  );
 
-  foreach (uc_product_types() as $type) {
-    uc_catalog_add_node_type($type);
-  }
+  return $presets;
 }
 
 /**

=== modified file 'uc_product/uc_product.module'
--- uc_product/uc_product.module	2009-08-14 19:10:32 +0000
+++ uc_product/uc_product.module	2009-08-19 12:53:48 +0000
@@ -273,9 +273,6 @@
     uc_product_add_default_image_field();
   }
 
-  if (module_exists('imagecache')) {
-    uc_product_add_imagecache_presets();
-  }
 }
 
 /**
@@ -1104,8 +1101,7 @@
         break;
       }
       else {
-        $actions = imagecache_preset_actions($preset);
-        if (empty($actions) && $preset_name != 'product_full') {
+        if (empty($preset['actions']) && $preset_name != 'product_full') {
           $action_check = 0;
           break;
         }
@@ -2014,62 +2010,65 @@
 }
 
 /**
- * Create imagecache presets for use on Ubercart pages.
+ * Implementation of hook_imagecache_default_presets().
  */
-function uc_product_add_imagecache_presets() {
-  $presets = array('product', 'product_full', 'product_list', 'uc_thumbnail');
-  if (module_exists('uc_catalog')) {
-    $presets[] = 'uc_category';
-  }
-  if (module_exists('uc_cart')) {
-    $presets[] = 'cart';
-  }
-
-  foreach ($presets as $preset_name) {
-    $preset = imagecache_preset_by_name($preset_name);
-    if (empty($preset)) {
-      // No preset of that name, so make a new one.
-      $preset = imagecache_preset_save(array('presetname' => $preset_name));
-    }
-
-    $actions = imagecache_preset_actions($preset);
-    if (empty($actions)) {
-      // The preset has no actions, so scale the image.
-      $action = array(
-        'action' => 'imagecache_scale',
-        'presetid' => $preset['presetid'],
-        'weight' => 0,
-        'data' => array(
-          'upscale' => 0,
-        ),
-      );
-      switch ($preset_name) {
-        case 'product':
-        case 'product_list':
-          $action['data']['width'] = '100';
-          $action['data']['height'] = '100';
-        break;
-        case 'cart':
-          $action['data']['width'] = '50';
-          $action['data']['height'] = '50';
-        break;
-        case 'uc_category':
-          $action['data']['width'] = '96';
-          $action['data']['height'] = '96';
-        break;
-        case 'uc_thumbnail':
-          $action['data']['width'] = '35';
-          $action['data']['height'] = '35';
-        break;
-        default:
-          // Do not save the action and get the next preset.
-          // Continue thinks swtich() is a loop, so continue it and the
-          // foreach().
-        continue 2;
-      }
-      imagecache_action_save($action);
-    }
-  }
+function uc_product_imagecache_default_presets() {
+  $presets = array();
+
+  $presets['product'] = array(
+    'presetname' => 'product',
+    'actions' => array(
+      array(
+        'weight' => '0',
+        'module' => 'uc_product',
+        'action' => 'imagecache_scale',
+        'data' => array(
+          'width' => '100',
+          'height' => '100',
+          'upscale' => 0,
+        ),
+      ),
+    ),
+  );
+
+  $presets['product_full'] = array(
+    'presetname' => 'product_full',
+    'actions' => array(),
+  );
+
+  $presets['product_list'] = array(
+    'presetname' => 'product_list',
+    'actions' => array(
+      array(
+        'weight' => '0',
+        'module' => 'uc_product',
+        'action' => 'imagecache_scale',
+        'data' => array(
+          'width' => '100',
+          'height' => '100',
+          'upscale' => 0,
+        ),
+      ),
+    ),
+  );
+
+  $presets['uc_thumbnail'] = array(
+    'presetname' => 'uc_thumbnail',
+    'actions' => array(
+      array(
+        'weight' => '0',
+        'module' => 'uc_product',
+        'action' => 'imagecache_scale',
+        'data' => array(
+          'width' => '35',
+          'height' => '35',
+          'upscale' => 0,
+        ),
+      ),
+    ),
+  );
+
+  return $presets;
 }
 
 /**

