I had a request approach me and am blanking on a smooth way to implement this. We have on content type that on occasion will have a background image in a a div. The image will be a washed out background image behind content. The content authors want to add this page by page using an Image Field.

How would you implement this?

I'm assuming I can do this through our custom theme -- perhaps a theme_preprocess_page() or theme_process_page()?


You could try BackgroundField:

BackgroundField started as an extension of the CCK ImageField that allows a CSS selector and background attributes to be set for a content-type. This is particularly helpful for allowing your node authors to add images to a node that are integrated into the theme of the site. With the inclusion of the Image field in Drupal 7, BackgroundField was rewritten to extend that core functionality.

  • With this module added I removed a gunk load of code from my templete.php file. It looks so nice and clean again. Thank you. Thank you.
    – Rick
    Oct 10 '12 at 15:13

I created a module to do that: Field Group Background Image

The idea is creating a div wrapper (with Field Group), specifying the image field of your content type as the background image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.