function theme_image_attach_teaser in Image 5
Same name and namespace in other branches
- 5.2 contrib/image_attach/image_attach.module \theme_image_attach_teaser()
Theme the teaser.
Override this in template.php to include a case statement if you want different node types to appear differently. If you have additional image sizes you defined in image.module, you can use them by theming this function as well.
File
- contrib/
image_attach/ image_attach.module, line 440 - image_attach.module
Code
function theme_image_attach_teaser($node) {
$img_size = variable_get('image_attach_size_teaser_' . $node->type, '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;
}
$info = image_get_info(file_create_path($image->images[$img_size]));
$output = '<div style="width: ' . $info['width'] . 'px" class="image-attach-teaser">';
$output .= l(image_display($image, $img_size), "node/{$node->nid}", array(), NULL, NULL, FALSE, TRUE);
$output .= '</div>' . "\n";
return $output;
}
}