hi:
i have the image_attach option activated with a story content type. I attach one image and it shows as a thumbnail...very nice.
Now the user clicks on the thumbnail and it goes to the node page where i want to show the full image and not show the thumbnail.

how to do this?

thanks in advice

here i have it installed http://64.13.213.116/drupal/audio/one-more
but it is only showing the thumnail image

CommentFileSizeAuthor
#11 image_attach_85952.patch1.21 KBdrewish

Comments

jasonwhat’s picture

Category: support » bug

I second this. Every image creates a link to the node page that the users is already viewing, not a link to the node with the full image. I'm changing to a bug report because the link on the thumbnail is supposed to go to the full image.

dodorama’s picture

Don't know if this behaviour is a mistake or a will of the developer, anyway you can always have it the way you want (full size image on node view) by overriding the theme_image_attach_body function in template.php

basicmagic.net’s picture

i have fixed this... will post asap...
here is my desired behavior- and how i have it working now:

1- attached image is viewed as thumbnail in node list view,
and the attached image links to node

2- attached image is viewed as thumbnail (or preview, or original) in node view-
and attached image links to image node

looks great and works great... simple fix

will post later tonight

thanks-
vincent

basicmagic.net’s picture

in image_attach.module- find this line:


  $output .= l(image_display($image, 'thumbnail'), "node/$node->nid", array(), NULL, NULL, FALSE, TRUE);

and change to:


  $output .= l(image_display($image, 'thumbnail'), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);

-- please note the change from "node/$node->nid" to "node/$node->iid"

this is what did it for me... running drupal 4.7.3

and image_attach.module version 1.2 2006/05/14

dvessel’s picture

Priority: Normal » Minor

As dodazzi stated, this is easily overridable in template.php.

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['thumbnail']));
  $output = '';
  $output .= '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
  $output .= l(image_display($image, 'thumbnail'), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
  $output .= '</div>'."\n";
  $output .= $node->body;
  return $output;
}
drewish’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

marked http://drupal.org/node/115068 as a duplicate of this.

JohnG-1’s picture

Status: Active » Reviewed & tested by the community

@ drewish : thanks for the link to here.

(I hope it's not bad netiquette for anyone other than the maintainer to alter the 'status' of an issue?)

Would it be very difficult to commit this patch ?

IMHO the argument for this as default behaviour seems compelling. Across the two threads I count 7 votes for and 0 votes against. If anyone can think of any 'counter-arguments' I would be grateful to read them (please feel free to PM me if you prefer). I'm not looking for a debate, only to establish if there are any reasons for the current behaviour.

If this is not committable I'll make a handbook page for image_attach under http://drupal.org/handbook/modules/image and copy this 'alternative configuration' code there. Does that sound fair ?

drewish’s picture

Status: Reviewed & tested by the community » Needs work

JohnG, changing the status is okay provided you've throughly tested the patch. but this isn't a proper patch see http://drupal.org/patch for info on creating a patch.

jacauc’s picture

subscribing

jorisx’s picture

with the code from dvessel I had to disable to lines to get this working in 5.1
enable this would give an error: //theme_add_style(drupal_get_path('module', 'image_attach') .'/image_attach.css');
enable this would show the body text twice: //$output .= $node->body;

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['thumbnail']));
  $output = '';
  $output .= '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
  $output .= l(image_display($image, 'thumbnail'), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
  $output .= '</div>'."\n";
  //$output .= $node->body;
  return $output;
}
drewish’s picture

Status: Needs work » Needs review
StatusFileSize
new1.21 KB

this will apply to HEAD or 5.x-1.x-dev

drewish’s picture

Status: Needs review » Fixed

i've committed my patch to HEAD and DRUPAL-5

JohnG-1’s picture

thanks drewish :)

Anonymous’s picture

Status: Fixed » Closed (fixed)