Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.27
diff -p -0 -r1.27 image.admin.inc
*** modules/image/image.admin.inc	21 Oct 2010 20:50:43 -0000	1.27
--- modules/image/image.admin.inc	31 Oct 2010 11:06:03 -0000
*************** function image_style_form($form, &$form_
*** 104 ****
--- 105,107 ----
+       if (!empty($effect['form include_file'])) {
+         require_once $effect['form include_file'];
+       }
*************** function image_style_form($form, &$form_
*** 109 ****
!         '#access' => $editable && isset($effect['form callback']),
--- 112 ----
!         '#access' => $editable && isset($effect['form callback']) && function_exists($effect['form callback']),
*************** function image_effect_form($form, &$form
*** 392 ****
--- 396,399 ----
+
+   if (!empty($effect['form include_file'])) {
+     require_once $effect['form include_file'];
+   }
Index: modules/image/image.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.api.php,v
retrieving revision 1.5
diff -p -0 -r1.5 image.api.php
*** modules/image/image.api.php	11 Sep 2010 01:54:43 -0000	1.5
--- modules/image/image.api.php	31 Oct 2010 11:06:04 -0000
***************
*** 25 ****
--- 26,31 ----
+  *   - "effect file": (optional) The file name where the "effect callback" function is in.
+  *   - "effect file path": (optional) Path to "effect file". Default is the module directory.
+  *   - "effect include_file": (internal) Calculated value from "effect file" and "effect file path".
+  *     If you override those values in hook_image_effect_info_alter(),
+  *     you need to override this value too.
+  *     See this helper function image_effect_info_callback_include_file().
***************
*** 29 ****
--- 36,41 ----
+  *   - "form file": (optional) The file name where the "form callback" function is in.
+  *   - "form file path": (optional) Path to "form file". Default is the module directory.
+  *   - "form include_file": (internal) Calculated value from "form file" and "form file path".
+  *     If you override those values in hook_image_effect_info_alter(),
+  *     you need to override this value too.
+  *     See this helper function image_effect_info_callback_include_file().
*************** function hook_image_default_styles() {
*** 192,194 ****
!  /**
!   * @} End of "addtogroup hooks".
!   */
--- 204,206 ----
! /**
!  * @} End of "addtogroup hooks".
!  */
Index: modules/image/image.effects.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.effects.inc,v
retrieving revision 1.5
diff -p -0 -r1.5 image.effects.inc
*** modules/image/image.effects.inc	6 May 2010 05:59:31 -0000	1.5
--- modules/image/image.effects.inc	31 Oct 2010 11:06:04 -0000
*************** function image_image_effect_info() {
*** 17 ****
--- 18 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 18 ****
--- 20 ----
+       'form file' => 'image.admin.inc',
*************** function image_image_effect_info() {
*** 24 ****
--- 27 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 25 ****
--- 29 ----
+       'form file' => 'image.admin.inc',
*************** function image_image_effect_info() {
*** 31 ****
--- 36 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 32 ****
--- 38 ----
+       'form file' => 'image.admin.inc',
*************** function image_image_effect_info() {
*** 38 ****
--- 45 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 39 ****
--- 47 ----
+       'form file' => 'image.admin.inc',
*************** function image_image_effect_info() {
*** 45 ****
--- 54 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 50 ****
--- 60 ----
+       'effect file' => 'image.effects.inc',
*************** function image_image_effect_info() {
*** 51 ****
--- 62 ----
+       'form file' => 'image.admin.inc',
Index: modules/image/image.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.module,v
retrieving revision 1.53
diff -p -0 -r1.53 image.module
*** modules/image/image.module	3 Oct 2010 05:14:58 -0000	1.53
--- modules/image/image.module	31 Oct 2010 11:06:06 -0000
*************** function image_permission() {
*** 244 ****
--- 245,259 ----
+  * Implements hook_hook_info().
+  */
+ function image_hook_info() {
+   return array(
+     'image_effect_info' => array('group' => 'image'),
+     'image_effect_info_alter' => array('group' => 'image'),
+     'image_style_save' => array('group' => 'image'),
+     'image_style_delete' => array('group' => 'image'),
+     'image_style_flush' => array('group' => 'image'),
+     'image_styles_alter' => array('group' => 'image'),
+     'image_default_styles' => array('group' => 'image'),
+   );
+ }
+
+ /**
*************** function image_effect_definitions() {
*** 907 ****
--- 923,924 ----
+           $effect['form include_file'] = image_effect_info_callback_include_file($effect, 'form');
+           $effect['effect include_file'] = image_effect_info_callback_include_file($effect, 'effect');
*************** function image_effect_definitions() {
*** 920 ****
--- 938,969 ----
+  * Build the full filepath for the "form callback"
+  * or "effect callback" include_file path.
+  *
+  * @param $effect
+  *    The effect info array, Retrived from hook_image_effect_info().
+  *
+  * @param $prefix
+  *    form|effect
+  *
+  * @param $module
+  *    The module name where the required file is belong to.
+  *
+  * @return string
+  *    Value of the "$prefix include_file", or NULL if the file does not exists.
+  */
+ function image_effect_info_callback_include_file($effect, $prefix, $module = NULL) {
+   if (!$module) {
+     $module = $effect['module'];
+   }
+
+   if (!empty($effect["$prefix file"])) {
+     $include_file = DRUPAL_ROOT;
+     $include_file .= '/' . (!empty($effect["$prefix file path"]) ? $effect["$prefix file path"] : drupal_get_path('module', $module));
+     $include_file .= '/' . $effect["$prefix file"];
+     if (is_file($include_file)) {
+       return $include_file;
+     }
+   }
+   return NULL;
+ }
+
+ /**
*************** function image_effect_apply($image, $eff
*** 1064 ****
!   module_load_include('inc', 'image', 'image.effects');
--- 1113,1115 ----
!   if (!empty($effect['effect include_file'])) {
!     require_once $effect['effect include_file'];
!   }
