Index: features.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.admin.inc,v
retrieving revision 1.1.2.68
diff -u -p -r1.1.2.68 features.admin.inc
--- features.admin.inc	20 Aug 2010 14:51:38 -0000	1.1.2.68
+++ features.admin.inc	20 Feb 2011 03:55:24 -0000
@@ -239,6 +239,23 @@ function features_export_build_form_subm
       $filenames[] = "{$module_name}.$extension";
       print features_tar_create("{$module_name}/{$module_name}.$extension", $file_contents);
     }
+    if ($asset_components = features_export_assets($export, $module_name)) {
+      foreach ($asset_components as $component => $types) {
+        foreach ($types as $type => $assets) {
+          foreach ($assets as $destination => $asset) {
+            if (is_file($asset)) {
+              $contents = file_get_contents($asset);
+              if (is_numeric($destination)) {
+                $asset = pathinfo($asset);
+                $destination = $asset['basename'];
+              }
+              print features_tar_create("{$module_name}/{$type}/{$component}/{$destination}", $contents);
+              unset($contents);
+            }
+          }
+        }
+      }
+    }
     if (features_get_modules($module_name, TRUE)) {
       $module_path = drupal_get_path('module', $module_name);
       // file_scan_directory() can throw warnings when using PHP 5.3, messing
Index: features.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/Attic/features.api.php,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 features.api.php
--- features.api.php	27 Sep 2010 15:44:38 -0000	1.1.2.4
+++ features.api.php	20 Feb 2011 03:55:25 -0000
@@ -160,6 +160,36 @@ function hook_features_export_render($mo
 }
 
 /**
+ * Define assets to be exported. This hook should be implemented
+ * with the name of the component type in place of `component` in the function
+ * name, e.g. `features_export_content_assets()` will allow modules to export
+ * assets related to a CCK field.
+ *
+ * @param array $data
+ *   An array of machine name identifiers for the objects to be rendered.
+ * @param array $export
+ *   The full export array of the current feature being exported. This is only
+ *   passed when hook_features_export_assets() is invoked for an actual feature
+ *   update or recreate, not during state checks or other operations.
+ * @param string $module_name
+ *   The name of the feature module to be exported.
+ * @return array
+ *   An associative array keyed with filetype ('images', 'templates', etc),
+ *   containing an associative array of files keyed with destination filename.
+ */
+function hook_features_export_component_assets($data, $export, $module_name) {
+  return array(
+    'images' => array(
+      'image.png' => '/path/to/image.png',
+      'thumbnails/image.png' => mycomponent_thumbnail('/path/to/image.png')
+    ),
+    'templates' => array(
+      'node/node-mycomponent.tpl.php' => '/path/to/node-mycomponent.tpl.php',
+    ),
+  );
+}
+
+/**
  * Component hook. The hook should be implemented using the name ot the
  * component, not the module, eg. [component]_features_export() rather than
  * [module]_features_export().
Index: features.export.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.export.inc,v
retrieving revision 1.1.2.63
diff -u -p -r1.1.2.63 features.export.inc
--- features.export.inc	27 Sep 2010 15:43:56 -0000	1.1.2.63
+++ features.export.inc	20 Feb 2011 03:55:25 -0000
@@ -255,6 +255,36 @@ function features_export_render($export,
 }
 
 /**
+ * Build an array of all required asset files.
+ *
+ * @param $export
+ *  An exported feature definition.
+ * @param $module_name
+ *  The name of the module to be exported.
+ *
+ * @return array of asset files to be exported.
+ */
+function features_export_assets($export, $module_name) {
+  features_include();
+  $files = array();
+
+  // Sort components to keep exported code consistent
+  ksort($export['features']);
+
+  foreach ($export['features'] as $component => $data) {
+    if (!empty($data)) {
+      // Sort the items so that we don't generate different exports based on order
+      asort($data);
+      foreach (module_implements($hook = "features_export_{$component}_assets") as $module) {
+        $files[$module] = module_invoke($module, $hook, $data, $export, $module_name);
+      }
+    }
+  }
+
+  return $files;
+}
+
+/**
  * Detect differences between DB and code components of a feature.
  */
 function features_detect_overrides($module) {
Index: features.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.module,v
retrieving revision 1.1.2.80
diff -u -p -r1.1.2.80 features.module
--- features.module	27 Sep 2010 15:43:56 -0000	1.1.2.80
+++ features.module	20 Feb 2011 03:55:26 -0000
@@ -279,7 +279,7 @@ function features_include($reset = FALSE
     // Features provides integration on behalf of these modules.
     // The features include provides handling for the feature dependencies.
     // Note that ctools is placed last because it implements hooks "dynamically" for other modules.
-    $modules = array('features', 'block', 'content', 'context', 'fieldgroup', 'filter', 'imagecache', 'menu', 'node', 'taxonomy', 'user', 'views', 'ctools');
+    $modules = array('features', 'block', 'content', 'context', 'fieldgroup', 'filter', 'imagecache', 'imagefield', 'menu', 'node', 'taxonomy', 'user', 'views', 'ctools');
 
     foreach (array_filter($modules, 'module_exists') as $module) {
       if (!module_hook($module, 'features_api')) {
Index: includes/features.imagefield.inc
===================================================================
RCS file: includes/features.imagefield.inc
diff -N includes/features.imagefield.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/features.imagefield.inc	20 Feb 2011 03:55:26 -0000
@@ -0,0 +1,20 @@
+<?php
+// $Id$
+
+/**
+ * Implements hook_features_export_component_assets() on behalf of ImageField.module.
+ */
+function imagefield_features_export_content_assets($data, $export, $module_name) {
+  $assets = array();
+
+  foreach ($data as $field) {
+    $args = explode('-', $field);
+    $field = content_fields($args[1], $args[0]);
+    if ($field['widget']['module'] == 'imagefield' && $field['widget']['use_default_image'] == TRUE) {
+      $assets['images'][] = $field['widget']['default_image']['filepath'];
+    }
+  }
+
+  return $assets;
+}
+
