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
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
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.
#3
Here's a new version of the last patch which fixes a problem with image
altandtitleattributes not displaying.#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.
#6
Sorry, made a small mistake in the last patch, here comes a new one.
#7
#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);
#10
Please test this patch instead.
#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
altandtitleattributes 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:<?phpfunction 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.
#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.
#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).
#19
Ugh! Sorry, found one more mistake in the code.
#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
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
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
@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.