Posted By

berkes on 03/12/07


Tagged

php image template drupal theme


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

basicmagic
kellyharding
panatlantica


link images to their own node.


 / Published in: PHP
 

URL: http://bezielen.nl

This snippet is for use with image module, a small contributed module for image handling. (Yes: in Drupal you need a /contributed/ module for this o_O.

The template snippet links the images to their own node.

  1. function phptemplate_image_attach_body($node){
  2. theme_add_style(drupal_get_path('module', 'image_attach') .'/image_attach.css');
  3.  
  4. $image = node_load($node->iid);
  5.  
  6. $info = image_get_info(file_create_path($image->images['preview']));
  7. $output = '';
  8. $output .= '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
  9. $output .= l(image_display($image, 'preview'), "node/$image->nid", array(), NULL, NULL, FALSE, TRUE);
  10. $output .= '</div>'."\n";
  11. $output .= $node->body;
  12. return $output;
  13. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: nareman on April 3, 2007

Nareman want to make love with LediLexa.

You need to login to post a comment.