Formatter outputs non existing images

ramsalt - October 10, 2007 - 10:44
Project:ImageCache
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

When using the field formatter with views, content for a non existing image is being generated. An easy solution to avoid this is to check if the the filepath exists, and then generate image content.

On line 729 in imagecache.module change the function to:

function theme_imagecache_formatter($field, $item, $formatter) {
  if (preg_match('/_linked$/', $formatter)) {
    $formatter = preg_replace('/_linked$/', '', $formatter);
    if ($item['filepath']){
$image = theme('imagecache', $formatter, $item['filepath'], $item['alt'], $item['title']);
    $output = l($image, 'node/'. $item['nid'], array(), NULL, NULL, FALSE, TRUE);
}
  }
  else {
  if ($item['filepath']){
    $output = theme('imagecache', $formatter, $item['filepath'], $item['alt'], $item['title']);
}
  }
  return $output;
}

Hope this is the right place to put it. Anyway, just pointing out a small bug in this very very nice module.

#1

dopry - January 5, 2008 - 10:12
Status:active» won't fix

a patch would be nice... I'm sure this issue will pop back up if it is still and issue.

 
 

Drupal is a registered trademark of Dries Buytaert.