You are here

function theme_image_attach_body in Image 5.2

Same name and namespace in other branches
  1. 5 contrib/image_attach/image_attach.module \theme_image_attach_body()

Theme the body

File

contrib/image_attach/image_attach.module, line 465
image_attach.module

Code

function theme_image_attach_body($node) {
  $img_size = variable_get('image_attach_size_body_' . $node->type, IMAGE_THUMBNAIL);
  if ($img_size != IMAGE_ATTACH_HIDDEN) {
    drupal_add_css(drupal_get_path('module', 'image_attach') . '/image_attach.css');
    $image = node_load($node->iid);
    if (!node_access('view', $image)) {

      // If the image is restricted, don't show it as an attachment.
      return NULL;
    }
    $class = 'image-attach-body' . ($image->status ? '' : ' image-unpublished');
    $info = image_get_info(file_create_path($image->images[$img_size]));
    $output = '<div style="width: ' . $info['width'] . 'px" class="' . $class . '">';
    $output .= l(image_display($image, $img_size), "node/{$node->iid}", array(), NULL, NULL, FALSE, TRUE);
    $output .= '</div>' . "\n";
    return $output;
  }
}