Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A patch is here http://drupal.org/node/113326
---
This snippet displays attached images (which requires the image module and image_attach) in a block. I'm no PHP expert, but I managed to combine the general block loading code (lines 1 & 2) with the theme_image_attach_body code from image_attach.module, which seems to work pretty well.
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->iid) {
$img_size = variable_get('image_attach_size_body_'. $node->type, IMAGE_ORIGINAL);
if ($img_size != IMAGE_ATTACH_HIDDEN) {
$image = node_load($node->iid);
if (!node_access('view', $image)) {
// If the image is restricted, don't show it as an attachment.
return NU
LL;
}
$output = '<div class="image-attach">';
$output .= l(image_display($image, $img_size), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
$output .= '</div>'."\n";
print $output;
}
}
}
Change the IMAGE_ORIGINAL to 'thumbnail' or 'yoursize' to have it display in a custom size.
Comments
List of files attached to node
Show list of attached files to node (Drupal 6):
| I'm a member of ukrainian Drupal-community.