Hello,

After a lot of tries I was unable to make lightbox show the title/caption on any image. I tried with title, alt or whateever possible

Example:

<a href="/sites/default/files/gallery/image.jpg" rel="lightbox[][my caption]" title="my caption" alt="suckme">click here!</a>

And there was no way to make lightbox2 show the title.

So I decided to try version 1.9 and it worked out of the box.

I hunted down the problem to be in the function updateDetails() of js/lightbox.js If you replace this function with the one at 1.9 it works out of the box too.

CommentFileSizeAuthor
#29 fix_missing_multiline_caption.patch4.41 KBsambfries

Comments

spruitje’s picture

A big thank you for this solution, it solved my problem with the title/captionc after hours of research...

You made my day! :)

seanajo’s picture

this was VEERY helpful tooonx!

guydaniels’s picture

fyi - I found that the function filterxss in lightbox.js is filtering out the entire caption. The parameter 'allowed_tags' to filterxss is uninitialized and that appears to cause everything to be filtered out. Bypassing filterxss makes it work, but not a good solution...

guydaniels’s picture

update - Problem (maybe not such a problem) seems to have to do with ajax call for filter-xss not working on localhost. I works fine on my midphase.com host. good enough for me...

mmj’s picture

I had the same problem, but not from beginning: everything was working fine for days, and suddenly all captions disappeared, I don't know why. I hope I "solved" the problem using old version of 'lightbox.js' as suggested above, but this is an issue to deal with.

NPC’s picture

Subscribing, will try this solution next week.

NPC’s picture

Hmmm, I completely removed the XSS filter call (only two trusted people are updating the site, so it is okay as an experiment), yet it didn't change anything for me :( I guess I need to look further. May be my issue is different, since I don't populate "title" on images, and hope to use "alt" instead - this should work as described on the Lightbox2 config screen.

KHofmeyer’s picture

Subscribing

Jim Bacon’s picture

I was experiencing a problem of no captions with lightbox 6.x-1.11 because I do not use clean urls. This may account for some of the above comments.

If I hack lightbox.js, line 1162, as follows all is well.

      url: Drupal.settings.basePath + 'index.php?q=system/lightbox2/filter-xss',
Lanoxx’s picture

Changing line 1162 did not work for me, and I'm also not sure where to get version 1.9. I find this a bit confusing, the official version is 2.04 while the drupal version is 1.11 so should I look for the Drupal version 1.9 or for the official version 1.9. A link would be really nice.

Please Fix this soon.

remote’s picture

+1 =/
subscribing - layout in use: "alternative"

plan9’s picture

Subscribing

EDDYL’s picture

You should (like I did) DOWNGRADE to drupal module version 6.x 1.9 : http://drupal.org/node/55200/release

Note to lightbox2 drupal developers : THIS BUG IS NOT SOLVED ! please do...

jduhls’s picture

The original post solved my problem, too. FYI, devs: dis here is a bug.

tjvaichus’s picture

Version: 6.x-1.x-dev » 6.x-1.11
Priority: Critical » Major
Status: Active » Needs review

I am having the same problem, NO captions with ver. 1.11 Lightbox2. The solution of going back to ver. 1.9 is not acceptable because Drupal returns a 'Security' alert and recommends updating to 1.10 or 1.11. I have removed other modules, assuming there might be a conflict, but so far that did not help.

UPDATE: Just in case someone made that same mistake as I - The solution to revert to Lightbox2 ver.1.9 fixes the 'caption not showing' problem. The reason I posted that it didn't work - I mistakenly reverted Drupal back to ver. 1.9 not realizing I should be reverting the Lightbox2 module to ver. 1.9.

All is well now - thank you for posting this fix.

dayer4b’s picture

Version: 6.x-1.x-dev » 6.x-1.11
Status: Active » Needs review

I've had problems with this as well. I may have found a solution..

line 1162 of js/lightbox.js (in the function filterXSS) shows:

      url: Drupal.settings.basePath + 'system/lightbox2/filter-xss',

I followed the AJAX request on this URL using FireBug in FireFox. As it turned out, this URL was going nowhere because I do not have short URLs enabled. I was able to fix this by changing the AJAX POST URL to the "long URL" version.

I changed it to this:

      url: Drupal.settings.basePath + '?q=system/lightbox2/filter-xss',

Just putting the path into the standard query parameter fixed it. I don't know if all of you folks are having the same problem as me, it would likely only happen if you do not have short URLs enabled. If that's the case, this may work for you!

oh! I just saw Jim Bacon's response. I guess that's the same thing I did ....

klaasklever’s picture

+1

i'm searching for days (v 1.11) and don't find a way to put my caption or a caption from a custom cck field in the lightbox. i understand you guys so, that this should happen by default? i only see the title, if i set this in the lightbox-settings...

or do i have to put something like >>> "rel="lightbox[][my caption]" title="my caption" <<< somewhere by hand? i'm asking, because there is no template for images and i really don't know where to put such parameters for my node-gallery-images. i even see a really good hint in the documentation.

i could deal with css but not really good with php...

do i have your problem or not?

greets, k

klaasklever’s picture

Priority: Major » Critical
Status: Needs review » Active

okay, i know, that developers have a life beside this one drupal module, but no reaction after months from them on a big problem like this - this is disappointing. lightbox2 is not a tiny module for special needs and this bug is not tiny too. at least i think, a reaction with a confirmation for one of the workarounds (downgrading) or a simple word should be possible, that's all.

i think, i have to downgrade and/or look for other modules as a workaround too.

Alphabool’s picture

Replacing the updateDetails() function found in js/lightbox.js in version 1.1 with the same function in version 1.9 as per the original post worked for me, but this still needs to be dealt with properly and committed.

wernerglinka’s picture

I replaced the updateDetails() function found in js/lightbox.js with the one from v1.9. That didn't work. However, when I changed the array index in line 721 to a "2" then it worked. The line 721 now reads:

var caption = Lightbox.imageArray[Lightbox.activeImage][2];
Ron Ostepchuk’s picture

Version: 6.x-1.11 » 6.x-1.10

I am running Drupal 6.22. My "update status" showed modules were unsecure and a security update was required for Lightbox2 6.x-1.9. So I updated to Lightbox2 6.x-1.10 as recommended.

Please note: I did pre-browse the known issues queue before the update but didn't pickup on this issue. I also ran the update on our development server first, but didn't detect the problem until I ran the update on production.

I now have a bug with my video player window. I think it is the same issue people are talking about in this thread. When lightbox loads, it does not display the caption and title boxes correctly under the video. There is blank space where the caption box should be and the title bar in now floating below the window disconnected from the video.

I have tried the recommended fixes in this thread, but they don't seem to work.

I need to either fix the issue and stay with 1.10 to maintain security or revert back to 1.9. But is this safe? What is the level of risk with this security issue? Could anyone help me fix this or advise on the risk of rolling back to Lightbox2 6.x-1.9?

Thanks,
Ron

aaronbauman’s picture

Version: 6.x-1.10 » 6.x-1.x-dev

This issue still applies to latest dev, and none of the above fixes did any good for me.

klaasklever’s picture

the module overview says: module is minimally maintained.
and i would change "under active developement" to "mostly inactive".

the developer(s) should act transparent and publish the minimal support situation. or ask for help. but this is not very helpful, sorry.

Ron Ostepchuk’s picture

Thanks aaronbauman and klassklever for taking the time to comment on this issue. I appreciate it. Ron

yukare’s picture

I am working on the version for drupal 7, and i will commit paths for drupal 6 if someone provide one.
About this issue: i do not have it in drupal 7, and none reported it too. In drupal 6, there was many ways to fix it, but each fix works for someone and do not work for others.
If someone provides a fix for this i will commit it, but a fix that works for everyone with the same issue, and not a fix for each site.
I will try to reproduce it in a site to work on a fix.

klaasklever’s picture

thank you yukare. i don't know, what you mean with "paths for drupal 6" and for sad i'm not a developer. but i will provide anything useful, handling templates and a bit php is possible.

regards, kk

d_hall’s picture

Version: 6.x-1.11 » 6.x-1.x-dev
Priority: Major » Critical
Status: Needs review » Active

One 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 making the caption display.

Aquillium’s picture

https://drupal.org/node/971754#comment-4058232

This worked for me, cheers. Although it does not reside on line 1162 anymore.

sambfries’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new4.41 KB

I was having this problem with the most recent version, and I narrowed it down to being caused by multiline captions (for me). I dug around in the javascript, and noticed that the regular expressions in parseRel were using .* to match everything inside of [ and ], instead of [^\]]*, which picks up content over multiple lines. I also made a few performance enhancements, and fixed an issue where an array was being used instead of an object– javascript arrays are intended for numeric indices only, though they are implemented as objects, which are in fact associative arrays, so

var parts = [];
parts["rel"] = null;

works, but only coincidentally.

var parts = {
    "rel" = null
};

is the correct way to do what you're trying to do.

Patch should be good with 7.x-1.x-dev.