I can't find this issue.. sorry if it is duplicate...
My imagefield of a CCK node type is displayed correctly in my view using an imagecache preset. awesome..

The problem is that this image field is not required for the content type... and some nodes don't have images defined... then in the views I have an image pointing to the folder of the preset... no image name... (it should not be there) resulting in a "image not found" icon in IE with a red X. In firefox is not displayed any image and nice but annoying in IE displayind that red x icon.

Comments

hedac’s picture

is there a way to return a specific image if the image field is NULL ?
it could be configured in the imagecache for each preset... as a defalut image if the image is not found... insted of returning a image not found error.

dopry’s picture

Title: image_field not required & imagecache views image not found » Imagecache 403/404 Image UI
Category: bug » task

You can set the imagefield to Required... which is one possible solution.

Regarding 404/403 images.... You can add a 404 or 403 image in the preset folder. This feature is not currenlty documented. I'd look in the source code where 403 and 404 responses are generated to figure out where and how to upload the files. I may complete the UI at some point, but it's not the first thing on my radar currently as I just finished rewriting most of the module.

You may see it in 2.1 or 2.2. I'm currently only working on making sure the module is ready for release. I've halted all new development for the time being, but I would welcome patches.

dezolt384’s picture

Same problem with ie7 and Safari, hedac. Did you find a solution?

dodorama’s picture

Category: task » bug

I'm experiencing the same problem. It seems that imagecache looks for the image even if there's no image uploaded. I think this is a bug
It's pretty annoying cause it results in a image not found icon in some browsers. Isn't there a way to have imagecache check if an image has been uploaded before to search for it?

My Setup
Drupal 5.7
Imagefield 5.1.1
Imagecache 5.1.3
CCK 5.1.6.1

dodorama’s picture

I just upgrade to imagefield 5.1.2 RC1 and problems isn't there anymore.

dopry’s picture

Category: bug » task

Still need to create a UI to add 403/404 image for presets... not to be confused with default images for fields...

I'm talking more about imagecache/thumbnail/some/image/that/doesn't/exist.jpg

nrudi’s picture

I'm using imagefield 5.x-2.1 and imagecache 5.x-1.3. The problem can be resolved in one of two ways:

Method 1: Add the following function in template.php
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
if (!file_exists($path)) {
return ' ';
}
else {
$attributes = drupal_attributes($attributes);
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
return 'Only local images are allowed.';
}
}

Method 2: Change the core file imagecache.module to
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
if (!file_exists($path)) {
return ' ';
}
else {
$attributes = drupal_attributes($attributes);
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
return 'Only local images are allowed.';
}
}

PS: return 'Only local images are allowed. does not seem to show up properly in the else {....} statement.

drewish’s picture

Status: Active » Closed (won't fix)

i'm marking this as won't fix since i want to trash the whole 404 403 image feature.

Anonymous’s picture

Status: Closed (won't fix) » Active

Can we perhaps discuss this feature? What is the reason you want to trash it?

Personally I run a site with zillions of images, and sometimes there will be defect images.

An imagecache 403 feature could show the default image. I found the (undocumented) 403 featured highly useful.

In imagecache.module:

FIND:

  // Bail if the requested file isn't an image you can't request .php files
  // etc...
  if (!getimagesize($src)) {
    watchdog('imagecache', '403: File is not an image %image ', array('%image' => $src), WATCHDOG_ERROR);
    header('HTTP/1.0 403 Forbidden');
    exit;
  }

CHANGE TO:

  // Bail if the requested file isn't an image you can't request .php files
  // etc...
  if (!getimagesize($src)) {
    $src = file_create_path('imagecache/'. $presetname .'.403.png');
  }

And of course don't forget to create default images in your /files/imagecache/$presetname.403.png location.

Anonymous’s picture

Category: task » feature
fizk’s picture

Status: Active » Closed (fixed)

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