Hey guys I'm having a problem I've been trying to warp my hand around for days now, without solution.
I'm using Lightbox (same error happens in Thickbox tho) to display the original sized images I uploaded with the image_attach module. Lightbox is working fine on teaser nodes, where the images are linking to the full body node. But on the full node, Lightbox (and Thickbox) are not working at all on the images.
I noticed that in teaser view, Light/Thickbox add a special class tag to the image in order to trigger the box. It seems that this trigger is related to the link generated by the image in the teaser view. Unfortunately there is no such link in the full node view image itself, since the links to the original images are displayed at the BOTTOM of the node and not on the image itself. It seems that because my preview images in the full node view have no links attached to them directly (have no tag), the Light/Thickbox cannot trigger.
Is there any way to fix this?
I need Light/Thickbox to trigger in full node view too, not only in teaser view on the front page. I guess a workaround for me would be to have any thumbnail or preview image link directly to the original image no matter if they are displayed in teaser of full node view.
By the way, Lightbox and Thickbox are set to trigger on preview and thumbnail images. So that should not be the problem here.
I'd be really grateful for any help, since this is slowly driving me nuts.
Thanks in advance.
Comments
Comment #1
paddes commentedI'm sorry, but the "a" class tag screwed my post up a little bit :)
Comment #2
paddes commentedWell, I've tried the whole image module / lightbox 2 combination on e new drupal install now without success. As I said before, Lightbox triggers fine in teaser node view on the index page but it wont trigger in full node view, no matter what I try.
Is there really nobody else having the same problem? I mean the lightbox module even states that it supports image module but it simply is not true. They seem not to work well together!
Comment #3
joachim commentedThere is an issue on Thickbox already I think. If LB is giving you problems, please file there.
Comment #4
paddes commentedThanks for the reply, but I think the reason why thickbox cannot trigger is because there is no link ON the preview Image in full node view. Adding a simple link to the original Image ON the preview image itself would certainly remedy this problem. Any clue on how to add such a link maybe?
Comment #5
paddes commentedFor more information on why it's not working, see the related thread on the Lightbox2 forums:
http://drupal.org/node/324241
"When using the image module, it's not possible to click on the image when viewing the node and have it trigger the lightbox. This is because the image is not enclosed in a link. If you use cck + imagefield, then this is possible."
So I'd say it's definitely an Image module problem.
Comment #6
paddes commentedSo I worked a little bit more on this and it seems like what was stated above is true.
I did a little hack of the "image.module" an changed this line:
/**
* Theme a body
*/
function theme_image_body($node, $size) {
return image_display($node, $size);
}
to this:
/**
* Theme a body
*/
function theme_image_body($node, $size) {
return l(image_display($node, IMAGE_PREVIEW), 'node/'. $node->nid, array('html' => TRUE));
}
Lightbox is working fine now.
Comment #7
joachim commentedI'm really not going to put in a link to the node itself on the image -- it'll look silly when LB is not being used.
Can't LB do a bit of fancy JQ and add the A itself?
Comment #8
paddes commentedGreetings joachim,
of course not. I didn't suggest my dirty fix should be implemented but at least it makes image module and lightbox work well together. Since there are quite a lot of people using the same combo, wouldn't it be wise to add this as an optional setting though (implemented the proper way of course)?
Comment #9
joachim commentedI think it's up to LB to add the link with some JQ than for image module to add another setting that only serves to support another module.
Comment #10
broonWell, the whole thing about lightbox (and clones) is to ALTER existing links to images (and other objects), not to create links. This was the sole intention of the original lightbox script.
How about just test for the existance of lightbox2 module?
BTW: I've Lightbox2 and Image installed and it works pretty good without any code changes. I'm using Image to upload images and then attach these to nodes. Lightbox2 works on both teasers and full view.
Comment #11
joachim commentedI'm marking this wontfix: Image module can't reasonably detect the presence of any given *box module, and those modules should be able to add a link element around an image if they find one. I suggest you file issues on the respective *box modules for this.