Skip to main content

Taxonomy_image : alignment of taxonomy images

I discovered the taxonomy_image_node_display module, where a site admin can specify through the admin menu of the taxonomy_image module if he wants to display taxonomy images while displaying a node. This results in Slashdot like appearance, without having to manually modify the theme files. This is a great add-on for people who want to tweak the layout of their Drupal powered sites, but who aren't php professionals : Drupal themeing still remains a technical domain.


However, the image is specified as
&lt img src=...&gt
, resulting in an image, followed by a line break, and then the node text. This results in many whitespaces in the page, certainly if the used taxonomy images are starting to get a little big. It would be nice if an alignment attribute is added, (even better yet, though the taxonomy_image module settings menu), resulting in code like
&lt img src=... align=left &gt
(or align=right for that matter).


So I entered a feature request for this module, but that got rejected, because the module provides a div wrapper for image display. Tried that, but for some reason I never got the css working. So I digged into the code, and found a way of doing this, by adding an extra tag to the taxonomy_image_display API :

$my_attrs = array(
'width' => $current->width,
'height' => $current->height,
'align' => "right",
);



As you can see, taxonomy_image behaves cleanly again with this code snippet.