[support] CCK Imagefield - default image

Brian Puccio brian at brianpuccio.net
Tue Apr 1 23:49:59 UTC 2008


On Mar 31, 2008, at 1:52 AM, Domas Monkus wrote:
> Hi,
> I am displaying nodes with CCK imagefields in a grid view. For the
> nodes that have no image submitted, I would like to show a default  
> one.
> What would the best way to achieve this be (Drupal 5)?

You could do this with CSS. At the theme level, the <div> that holds  
the image can be assigned a background image (set to not tile and be  
just the right size as the images you already have in the grid). In  
your theme, include the image only if it exists. If it's there, it  
will display on top of the background of the <div> and and no one will  
know the background is there. If the image doesn't exist, people will  
just see the background image. You'll probably need to fix the  
dimensions of this containing <div>.

No module changing needed!


More information about the support mailing list