If no image is attached to a node, the teaser for the image will be a broken image-- looking at the source for the page, it outputs a img src to '/drupal/images/imagecache/image_teaser/' (or as appropriate to the installation), note just directory, no image file there.
See http://drupal.org/node/101748#comment-275116 for brief history.
Comments
Comment #1
jeff h commentedI can verify this is a problem. It can be fixed by adding the following to the top of the theme_imagecache_formatter function:
if (!$item['filepath']) {
return null;
}
But I believe this theme function should not even be called by the imagecache_field_formatter function if there is no image to generate HTML (ie theme) mark-up for in the first place. Perhaps that's what the first IF condition in imagecache_field_formatter() is trying to catch:
if (!isset($item['fid'])) {
return '';
}
...but for me, even empty image fields still have a fid.
Comment #2
jpetso commentedTo me, this sounds like a duplicate of this imagefield issue (starting with comment 20 or so). This is fundamentally broken in 5.x-1.x, you should upgrade to imagefield 5.x-2.x (together with imagecache HEAD) and I bet the problem disappears.
Comment #3
shrill commentedHi. I'm having the same problem and I'm using the latest version of imagefield, and 5x.2.1 of imagecache.
Is there a solution? Where does one find theme_imagecache_formatter?
Thanks,
Shrill
Comment #4
liquidcms commentedi can confirm this issue still exists.
i have 2.1 version of imagefield which i patched to get default imgs working in general and now defaults work with imagecache when part of a normal node page.. but when called in a tpl using the theme('imagecache') function the default img paths are not created properly.
same as above, i only get the path to the preset folder for the img src
i changed title, since not even close to being right.. lol
and not duplicate of issue above.. so changing that as well
Comment #5
liquidcms commentedComment #6
liquidcms commentedi can see now that the imagefield is not built for the node when it has no image and therefore nothing downstream (like imagecache has anything to work with)
i tried sorting out where the bug is that i am sure is in imagefield (or possibly cck) but gave up.. so i simply added this "hack" into my tpl that is creating my psuedo-teaser:
this lets icache do the right thing and build the required folders for the new default img for this preset
btw, as i stated earlier.. if the node is being created as the std full node or likely as a real teaser i am sure the node would be built correctly in which case the node object would have the image field (set to full size default img that is uploaded for the field) and then this would work correctly..
Comment #7
Maxkupr commentedThe better way is
as for me.
cause you don't know extention of file (it may be png, gif, etc.)
Comment #8
hixster commentedsubscribing
Comment #9
1kenthomas commentedclosing; assuming no further support. Correcting priority as well :P