When a token is entered such as [node:image_field:medium:path] the token passed to image_style_url is medium:path which generates a broken URL. We should rather pass the $type var which will always contain only the style token.

Comments

jpstrikesback’s picture

Status: Active » Needs review
StatusFileSize
new525 bytes

Here's a patch.

cmonnow’s picture

Issue summary: View changes

Although I haven't used this module just yet your changes make sense and would affect some of the other issued patches (e.g. https://drupal.org/node/1600266).

srobert72’s picture

#1600266: no more uri property returned has been commited and fixed.
So now patch proposed in #2064357-1: Token passed to image_style_url should be the style token only should be :
- $output[] = !empty($uri) ? image_style_url($token, $uri) : '';
+ $output[] = !empty($uri) ? image_style_url($type, $uri) : '';

deanflory’s picture

When applying the #1 patch with the changes suggested in #3, I get a FAIL:

Hunk #1 FAILED at 94.

Resulting edited patch:

2064357-pass-style-token-only.patch (edited with #3 changes)

diff --git a/imagecache_token.module b/imagecache_token.module
index adabe04..488a162 100644
--- a/imagecache_token.module
+++ b/imagecache_token.module
@@ -94,7 +94,7 @@ function imagecache_token_tokens($type, $tokens, array $data = array(), array $o
           $output[] = $field[$attribute];
         }
         else {
- $output[] = !empty($uri) ? image_style_url($token, $uri) : '';
+ $output[] = !empty($uri) ? image_style_url($type, $uri) : '';
         }
       }
       $replacements[$original] = implode(', ', $output);

Maybe I did something wrong but it seems like a reroll is needed.

damienmckenna’s picture

StatusFileSize
new579 bytes

Rerolled.

  • DamienMcKenna committed 8d3ec91 on 7.x-1.x
    Issue #2064357 by jpstrikesback, DamienMcKenna: Incorrect value passed...
damienmckenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.