If you upload an image with an ampersand (&) in the filename, Imagecache will refuse to display the image.
After a bit of investigation I found that Imagecache has a problem with a number of special characters in the image filenames.
The solution is a little Imagecache theme override in the template.php
Just copy & paste this code to the end of your template.php in the theme folder.
function phptemplate_imagecache
($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
// Check is_null() so people can intentionally pass an empty array of
// to override the defaults completely.
if (is_null($attributes)) {
$attributes = array('class' => 'imagecache imagecache-'. $presetname);
}
if ($getsize && ($image = image_get_info
(imagecache_create_path
($presetname, $path)))) {
$attributes['width'] = $image['width'];
$attributes['height'] = $image['height'];
}
$attributes = drupal_attributes
($attributes);
// here we add drupal_urlencode to make sure the path is encoded.
$imagecache_url = imagecache_create_url
($presetname, drupal_urlencode
($path));
return '<img class="mceItem" title="'. check_plain
($title) .'" src="'.$imagecache_url.'" alt="'. check_plain
($alt) .'">';
}
Comments
Think you'll want to have a
Post new comment