Hi,
We use imagecache with imagefield module and it works great. Many thanks.
We have discovered a minor bug: If the title of the uploaded image has an ampersand ( & ) in it, it will only display a link -- the imagecache image will not display.
It took us a long time to discover this; we tried everything. And then we tested it and sure enough, this is the problem.
I'm sure this is not a huge issue for you folks, but it's an interesting little bug. And we thought we'd pass it along to anyone who might run into the same issue and NOT know what it was.
cheers
ggevalt

Comments

BarneyLaurance’s picture

I think this is probably an issue of the image file name having an ampersand (or other special character), not the title.

I just had a user run into this issue on a live site, and I found this function on the web that seems to fix it when pasted into template.php:

http://www.computerminds.co.uk/drupal-imagecache-problems-special-charac...

function phptemplate_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
  if ($image = image_get_info(imagecache_create_path($namespace, $path))) {
    $attributes['width'] = $image['width'];
    $attributes['height'] = $image['height'];
  }
  // check is_null so people can intentionally pass an empty
  // array of attributes to override
  // the defaults completely... if
  if (is_null($attributes)) {
    $attributes['class'] = 'imagecache imagecache-'. $namespace;
  }
  $attributes = drupal_attributes($attributes);
  $imagecache_url = imagecache_create_url($namespace, drupal_urlencode($path));
  return '<img src="'. $imagecache_url .'" alt="'.
 check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
}

I used this, and it seemed to fix the problem. I think the main difference from the version of this function in imagecache.module is the use of drupal_urlencode().

BarneyLaurance’s picture

There's a lot of tickets on what I think is essentially the same issues: #615418 , #129433 , #791780 , #880098 . I don't know if someone wants to go through merge the information and and close all but one as duplicates.

fizk’s picture

Status: Active » Closed (fixed)

Please reopen if this is still an issue with ImageCache 6.x-2.0-rc1.