The Header Image module allows you to display an image on selected pages. If you want one image on the frontpage, another on all FAQ pages and yet another on the about us and contact pages, this is the module that can do it.

The concept

Header Image block
A block displayed in which the Header Image nodes will be displayed. Single or multiple blocks can be defined.
Header Image node
A selectable node type containing the Header Image. Usually one image per node, multiple nodes per Header Image block. The content of this node is displayed in the Header Image block. Which node is displayed in the block is determined by the Display conditions set per node.
Display conditions
Conditions on which a node is displayed. Each Header Image node contains a set of conditions which will be evaluated when a page is called. The node of which the conditions match the called page will be displayed in the Header Image block. A weight determines the order in which the Header Image nodes are evaluated.

Available conditions:

  • Node id,
  • Path,
  • Taxonomy,
  • Book,
  • Node type,
  • PHP code.

Installation

  1. Copy header image module to your modules directory and enable it on the admin modules page.
  2. Set access rights for admin and view on the access control page.
  3. If required create a node type to put your image in. Set node type(s) and conditions types on the header image settings page: Site configuration > Header image > Settings
  4. Create one or more blocks for header image at the add block page: Site configuration > Header image > Add
  5. Using the selected node type, upload one image into the node using a CCK image field.
    Image header is designed to work with a node containing only one image. However with custom theming you can display any node content and any part of the node content. By default the node content without the title, taxonomy or links is shown in teaser view. Enter the conditions applicable to each image in the appropriate fields.
  6. Enable the block in the region of your choice in the Blocks administration page: Site building > Blocks

Trouble shooting

  • Use the condition weight to control the order in which the conditions are evaluated. The node with the smallest weight number will be evaluated first.
    Tip: To use one image as default give it a high weight (10) and a condition always evaluating to true. For example: path: '*' or PHP: return TRUE;
  • If the block is (partly) not visible, check the Display settings of your node type. Header image uses the teaser view or full view depending on the Teaser setting: Administer > Content management > Content types > MyHeaderImageContentType > Display fields

Theming

  • By default the block will show the content of the node, without the title, taxonomy or links. The node is shown in teaser view or full view depending on the Teaser setting.
  • To show the full node with title, taxonomy, etc. use the theme function included in the README.txt file.

Comments

leepfoster’s picture

thanks

dIeGoLi’s picture

By default the node content without the title, taxonomy or links is shown in teaser view.

I followed your instructions and it worked for me. Thank you for your work. But the content title and image field label got still displayed by default, not as stated in the description above.

Excluding the field label is easy:
1. Go to: Administration->Structure->Content Type and click "manage display" on your header image node type
2. There you can set the fields label to

Excluding the title is easy as well, when you know theres a module for ;):
1. Install following module: Exclude Node Title
2. Go to: Administration->Modules->Exclude Node Title click "configure".
3. Disable the node title for your header image node type

A sidenote because I am a beginner.
First i tried to modify the modules code to exclude the node title. I could not figure out how to handle the $node variable in the headerimage-block.tpl.php. But I achieved it by replacing following function in headerimage.module from

function template_preprocess_headerimage_block(&$vars) {
  $node = $vars['node'];
  $node['title'] = NULL;
  if (module_exists('ds') && variable_get('headerimage_module_ds', false)) {
    $vars['content'] = drupal_render($node);
  } else {
    $vars['content'] = drupal_render($node->content);
  }
}

to

function template_preprocess_headerimage_block(&$vars) {
  $node = $vars['node'];
  $node['title'] = NULL;
  if (module_exists('ds') && variable_get('headerimage_module_ds', false)) {
	$content = drupal_render($node);
	$content = preg_replace("/<h2>(?s)(.*)<\/h2>/", "", $content);
    $vars['content'] = $content;
  } else {
    $vars['content'] = drupal_render($node->content);
  }
}

I know this is quite a primitive approach but I don't understand the system... Out of curiosity. How does (or should) this module achieve to just display the image content? Maybe this could explain why I did not experience the desired default behaviour.