Skip to main content

Articles tagged with "imagecache"

Drupal - imagecache problems with special characters

27th Sep 2008

We came across this problem on one of our Drupal sites the other day, someone uploaded an image with an ampersand in the filename, and imagecache refused to display the image. A bit of investigating revealed that imagecache had a problem with a number of special characters in the image filenames.

The solution is a little imagecache theme override - you can see examples for both Drupal5 and Drupal6 below

Drupal 5 version

function phptemplate_imagecache($namespace, $path, $alt = '', $title = '',
 $attributes = NULL) {
  $attributes = drupal_attributes($attributes);
  $imagecache_path = file_create_url(file_directory_path() .'/imagecache/'.
 $namespace .'/'. drupal_urlencode($path));
  return ''. check_plain($alt) .'';
Read more