Recently updated jQuery UI to 6.x-1.4 with the UI library 1.7.3. Then I updated modules dependent on the 1.7.x library (modal and latest jQuery UI module). Everything seemed to be working fine, but the lightboxes don't want to show captions anymore—even when I force it to use the node title as the caption. It makes a brief pause before loading a blank caption area. A link to this behavior in action can be found here: http://www.climas.arizona.edu/testing-lightbox-more
I use the Insert module to get the images into the content area and I have the Image Caption module use the alt text for the inline captions.

Thanks in advance for helping me investigate this. I'm not sure if Lightbox is even the culprit, but it seems to be the only module affected by the jQuery updates.

Comments

stella’s picture

Status: Active » Postponed (maintainer needs more info)

Hmmm you have a rel attribute of lightbox[group1][] - the second [] is meant to hold the caption. Put your caption text in there and it should work. Or you could also try removing the empty [] altogether and it might use the alt text. Try it and let me know how you get on.

Geijutsuka’s picture

Status: Postponed (maintainer needs more info) » Active

Ah-ha, It doesn't load the caption if I take out the second set of brackets, but it does display text if I type it into the brackets.

stella’s picture

Category: bug » support
Status: Active » Fixed

From looking at the code, that's intended, unless you're using the automatic image handling features, which you're not in this case.

Geijutsuka’s picture

Category: support » bug

I'm not changing this issue back to active, but I need a bit more explanation.
I don't have the automatic image handling features enabled, and I never had to have them enabled in the past (should I have them enabled?). I am relying on the functionality described in the lightbox general settings under "CCK display settings" where it says, "By default, the caption for imagefields is the image title text configured. If no title is configured, then the alt text will be used." Before this recent update, I set things up such that users could insert the image inline with the text, then put title text in the wysiwyg's image properties and that text would display in the lightbox. I don't mind going into the code and typing a caption into the brackets, but expecting the computer-illiterate users on the site to do that is unfortunately problematic. It looks as if the lightbox will only show text if it's manually typed into the rel attribute brackets. Are you saying that lightbox is working as expected and that something else is getting in its way of automatically grabbing the image's title text and displaying it in the lightbox?

stella’s picture

Status: Fixed » Postponed (maintainer needs more info)

The image that you have on that page appears to be a manually entered image, perhaps created by hand or perhaps inserted via a wysiwyg. It does not appear to be an image uploaded via the Image module, or flickr, or anything else that uses automatic image handling. It might be a CCK imagefield? maybe using insert module?

In any case it will try the following when trying to find a caption for CCK imagefields:

  • If there is a 'description' field enabled for the image and a description entered, it will use that.
  • Then it checks for the 'title' attribute
  • Failing that, then the 'alt' text
  • Finally, if all else fails OR if the use node title option is enabled, it will use the node title instead

However all of that is ignored if the theme_imagefield_image_imagecache_lightbox2() function has a value for $args['caption'].

So I guess is this an imagefield? Have you overwritten theme_imagefield_image_imagecache_lightbox2() if so? And failing that are you happy enough to add in debug print statements to see where $caption is being set to an empty string?

Geijutsuka’s picture

Status: Postponed (maintainer needs more info) » Fixed

Yeah, I'm using a CCK ImageField and the Insert module, and I haven't done anything in the theme relating to theme_imagefield_image_imagecache_lightbox2()...
I am more than willing to add debug print statements to find out where $caption is being set, but I've never delt with debugging print statements before and I'm such a novice that I would I need someone to hold my hand and show me how top implement them correctly. Is there a page on drupal.org that'll explain debugging to me?

stella’s picture

Status: Fixed » Postponed (maintainer needs more info)

Ah it's simple, just put in lines like print "after alt line: $image_title<br>"; after each line where that variable changes in that theme function.

Geijutsuka’s picture

At the risk of sounding like a complete novice dolt, I'm not sure exactly where you mean. Would this be in the lightbox2.formatter.inc file, after lines which are like this one:

$caption = $title . $node_link;
    if (isset($args['caption'])) {
      $caption = $args['caption']; // Override caption.
    }

?

Geijutsuka’s picture

New developments...

In my quest to solve this issue, I finally got to my sandbox, installed a new version of Drupal, and re-uploaded my jQuery stuff (jQuery UI 6.x-1.4, jQuery UI library 1.7.3 and jQuery Update 6.x-2.x-dev). I have a limited amount of up-to-date modules turned on to make inline images with lightboxes work: CCK FileField, ImageField, ImageCache, Insert, and Lightbox2. I made a new imagefield in the page content type for inserting images into content.

So, when I insert an image *and* have the user permission of downloading the original image, Insert places this code into the text area (no wysiwyg installed):

<a rel="lightbox[group1][<br /><br /><a href="http://localhost/sites/default/files/imagecache/600scale/images/pages/bau-var-pur.jpg" target="_blank" id="lightbox2-download-link-text">Download Original</a>]" href="http://localhost/sites/default/files/imagecache/600scale/images/pages/bau-var-pur.jpg"><img src="http://localhost/sites/default/files/imagecache/300scale/images/pages/bau-var-pur.jpg" alt="" title="" class="imagecache-300scale caption" /></a>

...which gives a string of code (Download Original</a>]" href="http://localhost/sites/default/files/imagecache/600scale/images/pages/bau-var-pur.jpg">) and breaks the lightbox.

When I do not have the permission of downloading the original, I get this code inserted:

<a rel="lightbox[group1][]" href="http://150.135.6.151/sites/default/files/imagecache/600scale/images/pages/bau-var-pur.jpg"><img src="http://150.135.6.151/sites/default/files/imagecache/300scale/images/pages/bau-var-pur.jpg" alt="" title="" class="imagecache-300scale caption" /></a>

...which allows the lightbox to work, but it's still not displaying a caption inside the lightbox.

I'm not sure what to make of all this, but can anyone else confirm or deny this behavior?

daemonchrist’s picture

Confirmed.

No captions in Lightboxes for images uploaded using Image Module either. See http://www.amberleechristey.com/photo-album/portfolio/wedding-photography

They were there prior to updating to 6.x-1.11 and required JQuery.

jan_v’s picture

Same here as #10 and #9.

Running latest versions. Lightbox seems to be doing his job. My 'rel' attribute gets set on the right images with the right value, but no caption is shown.

This is what happens:

<a href="http://mysite.com/files/images/myimage.preview.jpg" rel="lightbox[node_images][myimage 2&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;/node/10354&quot; id=&quot;lightbox2-node-link-text&quot; target=&quot;_blank&quot; &gt;bekijk&lt;/a&gt;]" class="lightbox-processed">
    <img height="167" width="250" class="image image-slideshow " title="myimage 2" alt="alt text of myimage" src="http://mysite.com/files/images/myimage.slideshow.jpg">
</a>

But when lightbox opens, no caption is shown. And if i change the value manually like rel="lightbox[node_images][testing]" i still get nothing.

paraklete’s picture

had the same problem with the caption disappearing. Showed up after I upgraded several things. Backtracked all and for that when I went back to 6.x-1.9 the caption came back. It is not there for 6.x-1.10 or 6.x-1.11. So now I am in a quandry. Do I show the captions and ignor the security warning?

NPC’s picture

Subscribing, have the same problem with images inserted from CCK ImageField using Insert module (on DEV).

Geijutsuka’s picture

Status: Postponed (maintainer needs more info) » Active

Unfortunately, this is still an issue... I am changing the status back to active in hopes it will get another look. I'm still confused about what to do regarding comments #7 and #8.

Petr Illek’s picture

Any progress in this issue?
I can confirm, that lightbox is not getting the caption whne using Insert module.