I've just posted a patch that adds default image capability to imagefield. Here is a patch that adds that capability to imagecache's imagefield formatter.

This patch requires the imagefield patch above to work.

Patch against DRUPAL-5--2.

Comments

recidive’s picture

StatusFileSize
new1.89 KB

My previous patch doesn't work with views fields. This one does.

Also, there is the issue with files not being deleted from database on the imagefield queue, so it will not work if you just delete the image when editing the module. We add a workaround here, e.g. a file_exists() check, but it won't solve the root of problem.

bsuttis’s picture

Thanks, this helps a lot. I'm just curious though -- while the default image shows up in my views, the default is not showing up in actual nodes.

The current solution I'm using is checking for the image field and if its 'view' isn't there, it prints out the same default image. Feels kinda gross though, I'm just checking to make sure that I didn't miss something, but does the default image only show up in views and not actual nodes?

Christopher Herberte’s picture

Title: Add default image support for imagefield formatter » Subscribe

+1 to commit

Christopher Herberte’s picture

Title: Subscribe » Add default image support for imagefield formatter

oops change title back... :P

liquidcms’s picture

does this work?

Seems like a great idea; but i see no default images. This is what i have done:

- installed latest 5.2 version of imagefield (that post says has required patch)
- i now see option in cck field for defining a default image
- applied patch here to latest imagecache module
- i now go to one of my nodes and delete the image - in views, blocks, and full node i now have no image.

I think i am doing this correctly - any chance i am not?

liquidcms’s picture

wow.. pretty confusing issue with at least 4 separate posts regarding this. Anyone know if there is a resolution at the end here - seems pretty simple as far as use case - admin can set a default image for a field and imagecache will create whatever versions of it are required as needed.

- I think i have latest imagefield and patched imagecache.
- i see that i can set a default image
- and i can see it gets loaded
- but nothing in image cache folders and no images displayed.

which piece am i missing?

liquidcms’s picture

ahhh, ok.. i see something now.. in one place in my site i have the default image showing - i guess perhaps ni a simple node teaser; but the other 10 places or so with views, fused views, tpls where i pull it is with imagecache theme... i don't get anything.

So i guess still some work to do here - but certainly a great idea - sadly though this site launches tomorrow so i guess i'll need to do the ugly code thing of adding this in all of my tpls :(

storbaek’s picture

Are you using version 2? I've been testing this version and I cannot get the default option to work either!

dopry’s picture

Status: Needs review » Fixed

Actually the fix happened in imagefield... We got a patch there that makes sure imagefield gets the default image from imagefield.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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