Not sure if this is a feature (request) or a bug...

I have an imagefield set as part of my Blog Content Type. It's not "required" and I only use it when I want to add an accompanying image.

The problem is that an image tag is added to the Theme whether there is an image or not. It looks like this:

 <div class="field field-type-image field-field-image"><div class="field-items"><div class="field-item"><img src="http://example2.com/sites/example2.com/files/imagecache/reduction384x288" alt="" title=""></div></div></div>

Notice that there is no actual image file here as source. All you have is the path!

Wouldn't it be better to first check (somehow) as to whether the image, if there is one, actually exists?

The way things are now, you get a broken link icon showing up at least in IE7 (see attached image).

Any help appreciated.

CommentFileSizeAuthor
#6 imagecache_13.patch1.75 KBBevan
imagefield_error_0.png15.22 KBleoklein

Comments

abramo’s picture

this is a *very* old issue, a very real one, critical I would say, mentioned in numerous past posts, and none of the maintainers ever cares to do anything about it.

abramo’s picture

correction: lots and lots (and lots) of talk, posts, ideas (the lot) since October 06 - but no determined, honest & serious effort to resolve the issue by any of those who have the programming capacity.

leoklein’s picture

It's a hack for imagecache but it works:

http://drupal.org/node/88136#comment-230649

My version of imagecache is 5.x-1.3 and the line to change is 744.

MacRonin’s picture

Just adding myself to the list of folks experiencing this problem. If the users browser is set to display an icon for missing IMGs it look terrible.

1. CCK version 1.5
2. imagefield version 1.1
3. permissions for your tmp and files directory. - tmp-777 files(renamed) - 777
4. download method (public or private files) public
5. imagefield configuration -
6. expected results - if no picture return correct status code and no HTML
7. the unexpected actual results partial HTML for a nonexistent image
8. Steps to reproduce the problem. craete a node with CCK that has filed defined but not used

dagomar’s picture

Thanks patachon!

that was what i needed; which makes me think this problem is not in imagefield but in imagecache.

cheers!

Bevan’s picture

Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.75 KB

Sounds like this is one of those bugs. I don't understand why -- it's rather trivial -- or at least seems so. Nor do I care to follow up a mess of older patches and arguments. Here's my $0.2, which also fixes a couple of issues with the drupal style guide (in progress); http://groups.drupal.org/node/6355

I'm happy to follow up this issue and fix or port the patch. We've been running a fairly large site for a while with these modifications with no issues yet but testing in a wider variety of environments is required.

quicksketch’s picture

Status: Needs review » Fixed

Thanks bevan. You're right, this was such a non-issue I don't know how it wasn't solved earlier. I committed the first chunk of your patch (to 5.x and 5.x--2) that fixed this issue, though the other 2 I left out because they're not related to this issue and I'm not sure if they're what I'd recommend (putting class "image" on an img tag?). We can discuss it in another issue. Thanks for your patch!

Bevan’s picture

Quick note. imagecache images are (usually) content-related-images. As pposed to interface, branding or template images. Hence a classifier saying that. Perhaps I generalized too much, or image isn't the right word. theme_image() uses it, and I wanted to be able to theme imagecache images and images all alike with some CSS. See the the drupal markup style guide (in progress) http://groups.drupal.org/node/6355 -- yes I should open a new issue for this...

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

drewish’s picture

it'd be great to get a new 1.x release so this fix can get shipped.

johnalbin’s picture

Project: ImageField » ImageCache

Moving to imagecache queue since the bug was there.

johnalbin’s picture