Is there an option in this module to disable the hyperlink on the image? I'm using this module just to add a picture besides a node so the user is not supposed to click on the image.

Thanks in advance

Comments

drewish’s picture

Status: Active » Fixed

you can use a theme function to do this: theme_image_attach_body() and theme_image_attach_teaser() would be what you'd want to override.

sp1r’s picture

Could you maybe describe it for me how to do that, im not familiar yet with these functions

drewish’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)
ilyastayfun’s picture

find the image_attach.module in modules/image/contrib and
in it:

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;
    }
    $info = image_get_info(file_create_path($image->images[$img_size]));

    $output = '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
    $output .= l(image_display($image, $img_size), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);

and change the last line as:

$output .= (image_display($image, $img_size));

christopherdoherty’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Can you explain this further, please?

I added the function to my template.php file, renamed it to reflect the name of the theme I'm using. What specifically do I need to change here? Sorry for such a newb question, but I appreciate any help you can provide.

Thank you.

drewish’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

you're removing the l() call (which creates a link) and its parameters. you can read about l() here: http://api.drupal.org/api/function/l/5

christopherdoherty’s picture

Thank you so much.