My setup:
- Drupal 5.7
- PHP 5.1.x
- Apache 2.0.x
- Gallery 2.2.4
- Drupal with clean URL off
- Gallery with clean URL off
Lightbox is working (http://drupal5.tbsk.no/?q=artikkel/denne-har-lightbox2-taggen-sl%C3%A5tt).
Gallery2 is working (http://drupal5.tbsk.no/?q=gallery).
But trying to get Lightbox2 to work with Gallery2 have so far been unsuccessful. I did some quick debugging with Firebug, and I got this from FF when loading this image on my test installation (http://drupal5.tbsk.no/index.php?q=gallery&g2_itemId=24):
$(child).attr("src") is undefined
lightbox2_init_triggers()auto_image_handli... (line 106)
e(Object length=1 0=a prevObject=Object jquery=1.1.2, function(), undefined)jquery.js (line 2)
e(function(), undefined)jquery.js (line 2)
lightbox2_init_triggers("img.inline,img.flickr-photo-img,img.flickr-photoset-img,img.ImageFrame_image,img.image-img_assist_cu...", "lightbox", undefined)auto_image_handli... (line 28)
lightbox2_image_nodes()auto_image_handli... (line 19)
e()jquery.js (line 2)
e()jquery.js (line 2)
e([function(), function(), function(), 1 more...], function(), undefined)jquery.js (line 2)
e()jquery.js (line 2)
[Break on this error] href = $(child).attr("src").replace(new RegExp(settings.image_node_s...
Any idea where to start looking?
--
Stein Magne
Comments
Comment #1
stella commentedFirst off you can't run both the Lightbox2 module and the jLightbox module on the same site. They do similar functions and can conflict with each other.
I took a look at your site but it seems you've no trigger classes enabled for the automatic image handling and there's no
rel="lightbox"on any image link, so it's impossible for me to debug.See #179261: Lightbox, Gallery2 and Drupal integration for more details on how to integrate gallery2 and lightbox2 modules.
Cheers,
Stella
Comment #2
steinmb commentedThanx for your swift reply :)
jLightbox? obs! Sorry about that, my mistake. Disabled and removed.
If you look at http://drupal5.tbsk.no/node/42 you will find a image with rel=lightbox. I have prev. read the node your are ref. to but I was unable to find what part I was missing.... If I now load a image in Gallery2:
Cheers
Stein Magne
Comment #3
stella commentedThere's no images with
rel="lightbox"on node/42. However there are some image blocks. Is it these images that you want to appear in a lightbox when clicked on? Or if you click on one of these images to open it in the gallery, do you then want to be able to click on this image to open it in a lightbox?If the first, it's not working because the image class name is "ImageFrame_none" instead of "ImageFrame_image" - I'm not sure why this is the case?
If the latter, then it's not working because there's no anchor tag around the image, i.e. the image isn't a link.
Cheers,
Stella
Comment #4
steinmb commentedDoh! After the second time pointing you to the same link and you still couldn't see it, I decided to test it as a anonymous user myself and you're right, anonymous users not have access to view the post.
I created a new article but it was also blocked by Drupal. I turned on/off the view access for nodes in drupal but unable to correct the problem. At some point doing some crazy testing the access policy at this site have got messed up badly.... Anyway dropped the database and did a new nice and clean install.
Now the front page only contains two articles, both of them with lightbox enabled (rel=lightbox). I also enabled the Gallery2 module and the input filter for gallery2. This is the only changes I have done to this clean installation.
I still se the js error when loading images. When I looked more closely the error is only triggered when the image also is available in a higher resolution.
Image 1 OK
Image 2 give an js error.
Sorry sorry sorry about pointing you to nodes that you didn't have access to.
Cheers
Stein Magne
Comment #5
stella commentedHmmm I can't reproduce the issue on my test site, but the attached patch might help. Try it out and let me know how you get on.
Cheers,
Stella
Comment #6
steinmb commentedHi, sorry about the delay. Rolled the patch but it didn't help. Loading this image I get:
$(child).attr("src") has no properties
http://drupal5.tbsk.no/sites/all/modules/lightbox2/js/auto_image_handlin...
Line 106
Comment #7
stella commentedLooks like you didn't clear your browser cache after applying the patch because line 106 is actually:
and does not contain any reference to
$(child).attr("src")Please clear your browser cache and try again.
Cheers,
Stella
Comment #8
stella commentedHowever, I've tweaked the js file slightly again. You can get the latest version here.
Cheers,
Stella
Comment #9
steinmb commentedYour right in #7 I should have checked the js code loaded to verify that the new code was loaded. Now the error is on line 36 as you correctly point out in #7.
#8. That fixes the problem! The image I used as a demo in #6 loads without any js error :) Great work.
Now I can go back to getting Lightbox2 to load images from my Gallery2 installation. I have been reading http://codex.gallery2.org/Gallery2:Lightbox_JS_Tutorial but not all of the info in this relates to a "Drupal - Gallery module - Lightbox2" installation and I find i kinda hard to read. All the parts about how to load lightbox.js I think I can safely omit, then they are already loading.
Is there any way we can make this integration less messy? I fear when the inserting all the code in the template-files will make i hard to keep any information up date with new versions of Gallery, modules, drupal, lightbox. Could we do some fancy jQuery things and insert the code or something similar?
My org. idea was using Lightbox to load the high-res (original) images from gallery2, since these brake my site layout. In my head this should easy but as a non js-ninja and little to non Gallery2 template experience I find it harder than I imagined.
When I get it up and running, I'll create a more up2date and easy howto for other users (I promise).
Cheers
Stein Magne
Comment #10
stella commentedClearer documentation would be great. It's been a while since I've tried to set it up, though my problem was I couldn't get gallery2 itself working. Maybe I'll give it another go again soon...
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #12
stella commentedReleased in Lightbox2 5.x-2.7 and 6.x-1.7.
Cheers,
Stella