From c73f068226766e42c5e8e8b5a5171558c010f50f Mon Sep 17 00:00:00 2001
From: Tom Kirkpatrick <tom@systemseed.com>
Date: Tue, 1 May 2012 21:59:31 +0200
Subject: [PATCH] Add image path to dimensions callback data

---
 core/modules/image/image.module |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 8fd8cee..574a44f 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -797,7 +797,7 @@ function image_style_create_derivative($style, $source, $destination) {
  *   Dimensions to be modified - an array with components width and height, in
  *   pixels.
  */
-function image_style_transform_dimensions($style_name, array &$dimensions) {
+function image_style_transform_dimensions($style_name, array &$dimensions, $path = NULL) {
   module_load_include('inc', 'image', 'image.effects');
   $style = image_style_load($style_name);
 
@@ -812,6 +812,7 @@ function image_style_transform_dimensions($style_name, array &$dimensions) {
       }
 
       if (isset($effect['dimensions callback'])) {
+        $effect['data']['source'] = $path;
         $effect['dimensions callback']($dimensions, $effect['data']);
       }
       else {
@@ -1142,7 +1143,7 @@ function theme_image_style($variables) {
     'height' => $variables['height'],
   );
 
-  image_style_transform_dimensions($variables['style_name'], $dimensions);
+  image_style_transform_dimensions($variables['style_name'], $dimensions, $variables['path']);
 
   $variables['width'] = $dimensions['width'];
   $variables['height'] = $dimensions['height'];
-- 
1.7.4.4

