Index: imagecache_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.module,v
retrieving revision 1.30
diff -u -p -r1.30 imagecache_ui.module
--- imagecache_ui.module	31 Mar 2009 03:11:26 -0000	1.30
+++ imagecache_ui.module	31 Mar 2009 04:18:11 -0000
@@ -13,6 +13,7 @@ function imagecache_ui_help($path, $arg)
   switch($path) {
     case 'admin/build/imagecache':
       return t('Manage ImageCache presets.');
+    case 'admin/build/imagecache/export_all':
     case 'admin/build/imagecache/%/export':
       return t('Place the following snippet in your module as part of <code>hook_imagecache_default_presets()</code>.');
   }
@@ -35,7 +36,14 @@ function imagecache_ui_menu() {
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -10,
   );
-
+  $items['admin/build/imagecache/export_all'] = array(
+    'title' => 'Export All',
+    'file' => 'imagecache_ui.pages.inc',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('imagecache_ui_preset_export_all_form'),
+    'access arguments' => array('administer imagecache'),
+    'type' => MENU_LOCAL_TASK,
+  );
   $items['admin/build/imagecache/add'] = array(
     'title' => 'Add new preset',
     'file' => 'imagecache_ui.pages.inc',
Index: imagecache_ui.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.pages.inc,v
retrieving revision 1.1
diff -u -p -r1.1 imagecache_ui.pages.inc
--- imagecache_ui.pages.inc	31 Mar 2009 03:11:26 -0000	1.1
+++ imagecache_ui.pages.inc	31 Mar 2009 04:18:11 -0000
@@ -41,6 +41,42 @@ function imagecache_ui_preset_overview()
 }
 
 
+
+function imagecache_ui_preset_export_all_form() {
+  $exported = "  \$presets = array();\n";
+
+  $presets = imagecache_presets(TRUE);
+  asort($presets);
+  foreach ($presets as $preset) {
+    if (isset($preset['presetid'])) {
+      unset($preset['presetid']);
+    }
+    if (isset($preset['storage'])) {
+      unset($preset['storage']);
+    }
+    foreach ($preset['actions'] as $id => $action) {
+      unset($preset['actions'][$id]['actionid']);
+      unset($preset['actions'][$id]['presetid']);
+    }
+    $exported .= "  \$presets['{$preset['presetname']}'] = ";
+    $exported .= str_replace("\n", "\n  ", var_export($preset, TRUE)) .';';
+    $exported .= "  \n";
+  }
+  $exported .= "  return \$presets;\n";
+
+  $form = array();
+  $form['export'] = array(
+    '#type' => 'textarea',
+    '#default_value' => $exported,
+    '#rows' => min(50, substr_count($exported, "\n")),
+    '#cols' => 80,
+    '#resizable' => FALSE,
+  );
+  return $form;
+}
+
+
+
 function imagecache_ui_preset_add_form($form_state) {
   $form = array();
   $form['presetname'] = array(
@@ -145,6 +181,7 @@ function imagecache_ui_preset_export_for
     $form_state['redirect'] = 'admin/build/imagecache';
   }
 
+  $exported = '';
   if (isset($preset['presetid'])) {
     unset($preset['presetid']);
   }
@@ -155,10 +192,8 @@ function imagecache_ui_preset_export_for
     unset($preset['actions'][$id]['actionid']);
     unset($preset['actions'][$id]['presetid']);
   }
-  $exported = '$presets = array();';
-  $exported .= "\n";
-  $exported .= '$presets[\''. $preset['presetname'] .'\'] = ';
-  $exported .= var_export($preset, TRUE) .';';
+  $exported .= "  \$presets['{$preset['presetname']}'] = ";
+  $exported .= str_replace("\n", "\n  ", var_export($preset, TRUE)) .';';
   $rows = substr_count($exported, "\n") + 1;
 
   $form = array();
