now it throw an error like:

Notice: Undefined index: uri in imagecache_token_tokens() (line 75 of .../imagecache_token/imagecache_token.module).

debugging it turns out that token no more return the uri property:

Array
(
    [UPLOAD_IDENTIFIER] => 145206651
    [alt] => Scopri i tesori dell'Umbria a bordo di una 500 cabrio 
    [fid] => 185
    [display] => 1
    [width] => 600
    [height] => 900
    [description] => 
    [upload_button] => Carica
    [remove_button] => Elimina
    [upload] => 
    [title] => 
)

Comments

d.sibaud’s picture

Status: Active » Needs review

I found a possible workaround,

on line 70 of imagecache_token.module:

if ($type == 'image-field' && !empty($data['image-field'])) {
    foreach ($tokens as $token => $original) {
      $urls = array();
      foreach ($data['image-field'] as $field) {
        $file = file_load($field['fid']);
        $urls[] = image_style_url($token, $file->uri);
      }
      $replacements[$original] = implode(', ', $urls);
    }
  }
j0rd’s picture

StatusFileSize
new799 bytes

I'm running in to this as well.

I believe it may be a core issue.

I've changed your patch around to not call the file_load should $field['uri'] exist for performance reasons, but otherwise it should work the same.

Additionally here's the core patch in question, which I believe may be related:
#1762772: Notice: Trying to get property of non-object in image_style_deliver()

hydra’s picture

Status: Needs review » Postponed (maintainer needs more info)

When does this happen, I can't get to the problem to test the patch properly.

j0rd’s picture

StatusFileSize
new779 bytes

FOr me, it happens all the time. Usually when I auto-create a "profile node" when a user account is created.

As mentioned previous, I believe it's related to this core bug in Drupal, which image derivatives are getting created, but not done, and other code gets run. So in those cases file uri doesn't exist....or something.

See my write up here and read the next couple posts:
https://drupal.org/node/1762772#comment-7367644

With that said, I upgraded imagecache_tokens with out re-applying this patch and the error has returned. I've re-patched image_cache tokens.

j0rd’s picture

Status: Postponed (maintainer needs more info) » Needs review

Testbot

damienmckenna’s picture

Issue summary: View changes
StatusFileSize
new748 bytes

Rerolled, and tidied up slightly.

damienmckenna’s picture

StatusFileSize
new917 bytes

This didn't work until I added the 'uri' value to _imagegecache_token_image_attributes().

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

  • DamienMcKenna committed 35ac389 on 7.x-1.x authored by j0rd
    Issue #1600266 by j0rd, DamienMcKenna: Added the 'uri' attribute.
    

Status: Fixed » Closed (fixed)

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