Image field is not displayed

Docc - November 11, 2008 - 12:24
Project:jQuery Lightbox
Version:6.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

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

#1

tijeika - November 21, 2008 - 21:35

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

dboulet - January 29, 2009 - 17:47
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

dboulet - January 29, 2009 - 17:49

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

forresto - February 9, 2009 - 22:19

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

dboulet - February 11, 2009 - 16:07

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

AttachmentSize
jlightbox_332903_d6port_3.patch 4.74 KB

#6

dboulet - February 11, 2009 - 21:14

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

#7

dboulet - February 11, 2009 - 21:13
AttachmentSize
jlightbox_332903_d6port_4.patch 4.76 KB

#8

babelfish - February 11, 2009 - 21:49

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

comargo - February 26, 2009 - 11:03

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

sun - February 26, 2009 - 17:00

Please test this patch instead.

AttachmentSize
jlightbox-HEAD.cck_.patch 4.36 KB

#11

dboulet - February 26, 2009 - 17:33

@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

dboulet - February 27, 2009 - 21:05

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

yrre7 - May 26, 2009 - 23:30

subscribe

#14

dboulet - May 27, 2009 - 15:11

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

poiu - July 24, 2009 - 12:57

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

#16

realityloop - July 26, 2009 - 22:43

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

#17

KarenS - August 26, 2009 - 10:46

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

KarenS - August 26, 2009 - 10:55

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

KarenS - August 26, 2009 - 11:04

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

AttachmentSize
jlightbox.new_.patch 5.44 KB

#20

dboulet - August 26, 2009 - 14:40

Thanks Karen, this works very well.

#21

realityloop - August 27, 2009 - 06:04

@#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

dboulet - August 27, 2009 - 14:15

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

#23

realityloop - August 31, 2009 - 00:32
Status:needs review» reviewed & tested by the community

working here after confirming settings as per #22

#24

plebe - September 23, 2009 - 03:21

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

dboulet - September 23, 2009 - 05:51

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

#26

Funkwarrior - September 24, 2009 - 18:51
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

dboulet - September 25, 2009 - 17:45
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

Gábor Mayer - October 11, 2009 - 15:37

cvs version of jlightbox doesn't work with imagefield.

 
 

Drupal is a registered trademark of Dries Buytaert.