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.
Hey everyone,
Seem to be having a problem with Lightbox2 and Drupal 7, the captions won't show in the lightbox. Anyone having the same problem, or have a suggestion for fixing?
Best Regards,
Stephen
Comments
Comment #1
Sameo CreditAttribution: Sameo commentedI have the same problem.
Comment #2
stephen.punwasi CreditAttribution: stephen.punwasi commentedHey Sameo,
Tried a fresh install, once again didn't work. Didn't have the time to figure out how to fix it, so I ended up using Yoxview instead. Similar features, not as customizable but if you're in a client-crunch you might want to check it out.
Keep us posted if you figure out what's not working, looks like the handler isn't passing on the information to be rendered.
Comment #3
blw0010 CreditAttribution: blw0010 commentedSame problem. I can not get the captions to show from the alt or title attribute.
Comment #4
tammo CreditAttribution: tammo commentedSame for me, subscribing
Comment #5
yukare CreditAttribution: yukare commentedI had this working in the past, so some change i did broke it, will work on this.
Comment #6
yukare CreditAttribution: yukare commentedIt works if you put it inside the rel tag, like rel="lightbox[][my caption here]" but is not working with title="my caption".
Comment #7
El Bandito CreditAttribution: El Bandito commentedHi
I'm having this problem too. I am using Views to display images in a sidebar and have selected a lightbox formatter. It looks like the rel=" attribute is corrupted. Here is what my browser sees output for one of the images :
Any thoughts appreciated.
Cheers
El B
Comment #8
yukare CreditAttribution: yukare commentedThis is related to #971754. I just commited a fix for it, and will commit it too in drupal 6 later. See http://drupalcode.org/project/lightbox2.git/commit/000ef72
I made a very simple testing site at http://jaguaribe.net23.net/ to show this working, just wait for the next dev release.
Comment #9
El Bandito CreditAttribution: El Bandito commentedThanks yukare. I downloaded the dev version but I must be to early as it didn't have the change. So I applied the tiny change by hand and it worked fine.
Thanks for your efforts and swift response.
Comment #10
yukare CreditAttribution: yukare commentedSince the solution worked for you, I will set again this issue as fixed.
Comment #11
cruze72 CreditAttribution: cruze72 commentedSorry, any ideas how this needs to be manually configured in views. Have a slideshow gallery and it still doesn't show the captions. Have used the dev version from 30th Dec.
Thanks
Comment #13
vegantriathleteI have installed the dev version (which does contain the small fix) and I still can't get the caption to display. It doesn't matter whether I use
rel="lightbox[][my caption]"
or the title (or alt) tags in my anchor. The caption does not display.Comment #14
Dadaisme CreditAttribution: Dadaisme commentedLike vegantriathlete (24th J), I'm using the last dev of lightbox and the caption is still missing.
Thx.
Comment #15
lastar84 CreditAttribution: lastar84 commentedWell here's something odd that may add to this exchange. I have the beta1 installed and not the dev. I created a gallery page with unlimited images (thumbs that open into the lightbox view and play a slideshow). I added 10 photos and the captions worked fine.
Then removed the photos (due to changing the nature of the gallery) and added 10 more. The captions suddenly stopped working -- or did they? I noted that they worked fine on a second browser in which I was NOT logged in as admin. So, I logged out of the first browser, and now the captions worked. Logged back in as admin, and they stopped working. Logged out and logged back in as a plain ole' authenticated user, and they worked okay.
I'm not sure if this is an isolated quirk, but it is possible that your image captions work fine for non-admin users. It's worth a try if you just want to get the site up and running.
Comment #16
attheshow CreditAttribution: attheshow commentedI'm having a similar experience to the above users. I'm using the January 1, 2012 dev version. I'm doing a slideshow via views, using the trigger field. Only anonymous users can see the caption.
Also, for some reason, even thought I have my trigger field's captions set to:
[title]<br />[body]<br />Here is some other text.
...it only shows the content of the [body] field as the caption for the anonymous user.
Comment #17
d_hall CreditAttribution: d_hall commentedTotally broken on my D7 site regardless of which version I use. No captions in the lightbox. The first problem with the dev version is the "broken/missing handler" error it gives when you try to add a Lightbox Trigger using Views. Which can be fixed by adding this line of code to lightbox2.info:
files[] = lightbox2_handler_field_lightbox2.inc
Comment #18
DrupalNovice CreditAttribution: DrupalNovice commentedHello,
Changing line 726 in the lightbox.js file from
var caption = Lightbox.filterXSS(Lightbox.imageArray[Lightbox.activeImage][1]);
to
var caption = Lightbox.imageArray[Lightbox.activeImage][1];
seems to solve the issue for now.
Comment #19
DrupalNovice CreditAttribution: DrupalNovice commentedBetter yet, see http://drupal.org/node/937908#comment-5479562
Comment #20
d_hall CreditAttribution: d_hall commentedThanks, but did not work for me.
Comment #21
genjohnson CreditAttribution: genjohnson commentedBoth #18 and #19 do not work for me.
Comment #22
thalemn CreditAttribution: thalemn commentedI can also confirm that #18 and #19 did not work for me.
The site I'm building is at: www.melissamollenhoff.com/style-gallery.
Using a view to show the image field with lightbox2 for formatter. Anyone have a work-around so we can put some text with the image in the lightbox display?
Comment #23
d_hall CreditAttribution: d_hall commentedOne bug I notice is that checking/unchecking "Show image caption" under the Lightbox2 settings only affects whether the "View original image" link appears. It has no effect on whether the caption displays.
Comment #24
StuartJNCC CreditAttribution: StuartJNCC commentedThe image_caption module works for me (7.x-1.0-beta3). It also creates a caption from the title using java. I must admit I didn't know that lightbox was supposed to do this until I read somewhere else (not Drupal related) that this was its default behaviour. It was only then that I looked for a reason why it wasn't working and found this thread. My worry is, if this module is eventually fixed so that the captioning works as intended, will I end up with two captions? I suppose I only need to disable image_caption if that happens.
Comment #25
El Bandito CreditAttribution: El Bandito commentedHi
I've just tried Lightbox 2 again a year after my first tussle with this issue in #4. Sadly although I can see from the code that the patch in #8 has now been commited I am still seeing no captions and the html output I am seeing is thus :
Again the rel attribute looks corrupt and now I have a stray comma in the html at the end.
I have tried both 7.x-1.0-beta1 and 7.x-1.x-dev.
Any suggestions appreciated.
Thanks
EDIT: Sorry, the comma seems to be part of my View ( not sure why ) as it still appears after I disable the Lightbox module.
Comment #26
josefnpat CreditAttribution: josefnpat commentedI've gone through about 4 different patches, the 7.x, 7.x-1.x, 7.x-1.x-beta along with a clone of the actual git repo in attempt to find a fix to this solution.
I ended up implementing a workaround, and I thought I would share it.
I needed a clickable image that would open up in a larger lightbox image, and offer a download link (regardless of it being private). Along with the title being the caption.
Here is how I override the view's field template;
Be sure to change field_field_gallery_image to field_field_[field name]!
The gallery thumbnail style (
$thumb
) image is generated withtheme()
. (in my case,fourth_gallery
)The url for the larger image style is generated with image_style_url. (in my case,
lb2_930
)The original image is pulled out from the row.
The title is extracted from the row.
The entire line is printed out with the proper values substituted.
views-view-field--Gallery--page--field-gallery-image.tpl.php
Comment #27
stephen.punwasi CreditAttribution: stephen.punwasi commentedThanks josefnpat, clever solution. I've since given up on this module and started using Yoxview or Colorbox on most of my projects.
Comment #28
scottzee CreditAttribution: scottzee commentedHas anyone found a solution to this?
I'm hoping to get some captions on images. Otherwise this is such a great module!
Comment #29
webbymatt CreditAttribution: webbymatt commentedThis is a big, big issue for this module. I've tried various fixes and nothing works - it's looking likely that I'll need to completely remove Lightbox2 and find something else which would be a shame. Any news on fixes from the contributors?
Comment #30
webbymatt CreditAttribution: webbymatt commentedI have found a solution, hopefully you'll be able to apply it to your own use case:
I have a content type with an image field. I then output these through a View. My title and alt fields were empty which lead me to think there was a problem with the way it was constructed in lightbox.js. Turns out it's being built correctly, I just had to enable and populate the "alt" and "title" attributes within the field in the content type - doh!
I suspect this may be the exact same thing many others are seeing.
Comment #31
thalemn CreditAttribution: thalemn commentedYes, that worked for me! Thank you very much!
Comment #32
MGParisi CreditAttribution: MGParisi commentedColorbox will take the page title and put it as the caption!
Comment #33
ykyuen CreditAttribution: ykyuen commentedIn my case, the caption is missing becoz i am using the views galleriffic module. it seems that the #caption cannot be located in the lightbox.js. i bypass the problem by
hope it could help.
Comment #34
cmiguel CreditAttribution: cmiguel commentedPopulating fields, that was it!!
Its not the Node Title its the title attribute from IMG tag.
Comment #35
scottzee CreditAttribution: scottzee commentedwebbymatt, that worked for me! thank you! (d'oh indeed!)
Comment #36
yukare CreditAttribution: yukare commentedI will close this issue as i can not reproduce it now with current code from git, if someone still have it please reopen this issue, and try to provide me a public site with the error, or meet me at irc #drupal.