Download & Extend

Image field is not displayed

Project:jQuery Lightbox
Version:6.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Followed the readme.txt

When selecting jLightbox: Slideshow for the displaying the imagefield. Nothing shows on the page.
Selecting a imagecache rule will show all images. But without slideshow.

Also no javascript referencing to jlightbox in source code. (jlightbox.js file is includes)

Am i missing something? im using drupal 6.4

Regards

Comments

#1

im using 6.6 drupal, when i chose jLightbox for display in my CCK fields - nothing shows at all!!! there is no image... dont know what to do...

#2

Title:Slideshow not showing» Image field is not displayed
Priority:normal» critical
Status:active» needs review

Same as tijeika, nothing showing at all using Drupal 6.9, ImageField 6.x-3.0-alpha4 and ImageCache 6.x-2.0-beta5. The biggest problems with the code are that it makes use hook_field_formatter(), which is now deprecated, and that it does not reflect changes made in the ImageField module, which now relies on the FileField module. I've attached a patch that fixes these problems, and also cleans up some trailing spaces in the code.

AttachmentSize
jlightbox_332903_d6port.patch 4.44 KB

#3

Here's a new version of the last patch which fixes a problem with image alt and title attributes not displaying.

AttachmentSize
jlightbox_332903_d6port_2.patch 4.73 KB

#4

this patch is giving me:
warning: unserialize() expects parameter 1 to be string, array given in .../sites/all/modules/jlightbox/jlightbox.module on line 157.

#5

Here's a new patch, should get rid of that warning.

AttachmentSize
jlightbox_332903_d6port_3.patch 4.74 KB

#6

Sorry, made a small mistake in the last patch, here comes a new one.

#7

AttachmentSize
jlightbox_332903_d6port_4.patch 4.76 KB

#8

dboulet,
Thanks for patch. I'm trying to get this module to work on D6, applied the last patch but images still don't show up in the image fields.

#9

At least attached patch works on my site, but I don't remember the reason of one change

--- jlightbox.module    15 Oct 2008 08:14:30 -0000      1.9
+++ jlightbox.module    26 Feb 2009 10:50:27 -0000
@@ -97,7 +97,7 @@
   if (!isset($item['fid'])) {
     return '';
   }
-  $file = _imagefield_file_load($item['fid']);
+  $file = field_file_load($item['fid']);
   $item = array_merge($item, $file);
   if (strpos($formatter, 'jlightbox][') !== FALSE) {
     list($module, $namespace, $type) = explode('][', $formatter);
AttachmentSize
jlightbox.module.hook_theme_fix.patch 2.09 KB

#10

Please test this patch instead.

AttachmentSize
jlightbox-HEAD.cck_.patch 4.36 KB

#11

@comargo, regarding your confusion about the change, if you are speaking specifically about the use of the field_file_load() function, I believe that this is used because the D6 version of the Imagefield module now depends on the Filefield module.

#12

With the patch in #10, the images show up but their alt and title attributes are always left blank. I had tried to fix this issue in the patch that I had submitted in #3, here is the bit of code that addresses the problem:

<?php
function theme_jlightbox_formatter($element) {
  if (isset(
$element['#item']['nid']) && $node = node_load($element['#item']['nid'])) {
   
$data = $element['#item']['data'];
    if (
$element['#item']['data'] && !is_array($element['#item']['data'])) {
     
$data = unserialize($element['#item']['data']);
    }
    foreach (
$data as $key => $value) {
      if (!isset(
$element['#item'][$key])) {
       
$element['#item'][$key] = $value;
      }
    }
    return
jlightbox_field_formatter($element['#field_name'], $element['#item'], $element['#formatter'], $node);
  }
}
?>

#13

subscribe

#14

Thought I'd update this issue with my latest code, this is what is working for me.

AttachmentSize
jlightbox-HEAD_332903_latest.patch 4.75 KB

#15

#14 works for me too (though I didn't check with alt and title attrs).

#16

#14 works, but I don't get next/prev links when there are multiple images exposed in a gallery style view

#17

The patch is pretty close to working but there are several remaining problems. It leaves the deprecated function in the code, which is confusing, instead of working that code into the new function. More important, it uses form_clean_id() to create gallery names which will make a different gallery name for each image. So instead of getting one gallery with six images you get six galleries with one image, which is why the back/next navigation isn't working (there is no back/next in a gallery with only one image). Also at one point the field name is passed through as the $field, and all the other field values are lost. And finally, there is some code looking for deprecated imagecache functions which could be removed because anyone using the old version of imagecache would have a ton of problems because that version doesn't work at all.

So here is a cleaned up patch that seems to be working.

AttachmentSize
jlightbox.new_.patch 5.53 KB

#18

Oops, found one more change. And just to clarify, the changes in #12 are incorporated into this patch (they were in the earlier patch too, but I couldn't tell that for sure by reading the issue).

AttachmentSize
jlightbox.new_.patch 5.51 KB

#19

Ugh! Sorry, found one more mistake in the code.

AttachmentSize
jlightbox.new_.patch 5.44 KB

#20

Thanks Karen, this works very well.

#21

@#19 When there are multiple images are I still am not getting the next/previous links when displaying full image, other than that it works great KarenS

#22

@realityloop This works fine for me. In the field display options, have you chosen 'jLightbox: presetname gallery', and not 'jLightbox: presetname'?

#23

Status:needs review» reviewed & tested by the community

working here after confirming settings as per #22

#24

Tried running this patch. asking me which file to patch. Fails when I specify jlightbox.js. has this been incorporated into the latest 6.x version?

#25

@plebe, This patch only affects the file jlightbox.module, it makes no changes to the JavaScript file.

#26

Component:Code» Miscellaneous
Category:bug report» support request
Status:reviewed & tested by the community» active

sorry, but it's impossible to me to make lightbox works... I apply the patch, js and css wrote correctly on the page, I made a Imagecache preset but there is no rel attribute on my image..
What I'm doing wrong? someone can tell me? Thank you!

#27

Component:Miscellaneous» Code
Category:support request» bug report
Status:active» needs review

@Funkwarrior, I'm assuming that you're trying to get this to work with an imagefield. If this is the case, have you chosen 'jLightbox: presetname gallery' or 'jLightbox: presetname' as the display option for that field?

#28

cvs version of jlightbox doesn't work with imagefield.

#29

Status:needs review» fixed

Sorry for leaving you all in the dark. Was way too busy with D7. :-/

Thanks for reporting, reviewing, and testing! Committed to HEAD.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

#30

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.