
Recently upgraded my site to d7 and wanted to have taxonomy images. This is extremely easy in Drupal 7 as you can add CCK fields to taxonomy. Some images used require a link back to the owner's website as a condition of use so I added a link field as well. Here is the taxonomy manage fields screen (goto edit vocabulary from structure, taxonomy):-

Note the two additional fields, Image and Link. The xm lsitemap field comes from the xmlsitemap module. On the "Manage Display" tab, I changed the label display to hidden.
If you now view a taxonomy term page, the image and link will display. However, this is not what I wanted. I needed to wrap the image inside the anchor tag to make the image clickable. I guess there are several ways to do this, but I found this worked. I added #pre_render code like this inside a custom module (xxx in this example):-
function xxx_page_alter(&$page) { $page['content']['system_main']['term_heading']['term']['#pre_render'][] = 'xxx_taxo_image_link'; } function xxx_taxo_image_link($elements) { $elements['field_image']['#prefix'] = '<a href="'. $elements['field_link']['0']['#markup'] .'">'; $elements['field_image']['#suffix'] = '</a>'; } return $elements; }
The first function adds a call to xxx_taxo_image_link() to the #pre-render array for the term in the heading. The second function makes the image linkable by adding the anchor tag using #prefix and #suffix. The if makes sure the wrapping only occurs if there is link data. The unset ensures the link is removed and not displayed.