Return to Snippet

Revision: 2580
at March 12, 2007 11:30 by berkes


Initial Code
function phptemplate_image_attach_body($node){
  theme_add_style(drupal_get_path('module', 'image_attach') .'/image_attach.css');
 
  $image = node_load($node->iid);
  
  $info = image_get_info(file_create_path($image->images['preview']));
  $output = '';
  $output .= '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
  $output .= l(image_display($image, 'preview'), "node/$image->nid", array(), NULL, NULL, FALSE, TRUE);
  $output .= '</div>'."\n";
  $output .= $node->body;
  return $output;
}

Initial URL
http://bezielen.nl

Initial Description
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.

Initial Title
link images to their own node.

Initial Tags
php, image, template, drupal, theme

Initial Language
PHP