enabled: cck / imagefield / imagecache / thickbox

by calling

<?php print $node->field_property_image[0]['view'] ?>

output is created by imagecache even when no image has been uploaded (no image exists). output is of the type:

<a href="http://localhost/drupal/files/" class="thickbox" rel="property"><img  src="http://localhost/drupal/files/imagecache/99x66-property" alt="" title=""  /></a>

therefore, browser displays "default missing image" (small square with red cross).

imagechache should not be creating any output when no image exists.
could this be kindly fixed?

many thanks,
abramo

CommentFileSizeAuthor
#4 imagecache-guard-output.patch685 bytesjpetso

Comments

dodorama’s picture

I'm experiencing the same issue.
I have imagefield/imagecache and thickbox installed.
I set the imagecache+thickbox formatter in the display field.
Then I uploaded an image.
Later I deleted the image from the content type.
The image tag is still there but with no link.

kalashari’s picture

I also need this feature. It should either display no image or display some "default" image.

abramo’s picture

Title: Creates output when image is non-existent » Imagecache creates output when image is non-existent

this also happens when there is a php snippet in the template (ex. contemplate) calling for an image and an image is not actually available/uploaded respective to this call. example: the snippet

<?php print $node->field_main_image[0]['view'] ?>

calls for image main_image but if this has not been uploaded by the user imagecache creates output without an image - therefore the browser displays the ugly image placeholder (with red x) instead of leaving the place blank.

jpetso’s picture

Status: Active » Needs review
StatusFileSize
new685 bytes

I don't have thickbox enabled, but this happens here at well. It seems that the image doesn't display at first, but when some image is uploaded and afterwards deleted again, its entry stays in the {content_type_TYPE} table even if the image is deleted from the {files} table.

I'm not yet as far into CCK as to know how to get the entry in {content_type_TYPE} deleted (I guess something must be done in imagefield_field(), but no idea what exactly has to be written there), but there's some lines in image{field,cache}_formatter() that should be there anyways. That's a simple check (on displaying) if the file could be retrieved, and if it could not be retrieved, don't attempt to show it.

Please review and commit (applies to the DRUPAL-5--2 branch).

jpetso’s picture

This issue is supposed to get the real fix done.

abramo’s picture

@jpatso : many thanks for your work on this issue, and making it available.
regrettably the proposed patch does not work.

abramo’s picture

correction:

@jpetso : many thanks for your work on this issue, and making it available.
regrettably the proposed patch does not work.

jpetso’s picture

Status: Needs review » Closed (fixed)

Closing this issue, as the bug is not in imagecache but in imagefield (has been linked above).