Posted by schlotterich on November 7, 2009 at 1:36pm
Jump to:
| Project: | Image |
| Version: | 6.x-1.x-dev |
| Component: | views support |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
Hello, for my Gallery I use Thickbox to view my Pictures. Always when I set the Style of my image_gallery View to Grid I can't switch through the Pictures of my View anymore. The Thickbox always closes when I click on the picture instead of jump to the next picture.
When I use another style like Gallery I don't have this error anymore and I can switch through all Images. Is this a known error?
Comments
#1
I've no idea I'm afraid.
If this problem is with the Grid style which is provided by Views module, then the problem is either with Views or with Thickbox -- image module can't change its output depending on what style is being used.
I'm marking this as wontfix; feel free to reassign this to another module and reopen it.
#2
my solutuion:
1. install views_customfield module (allow you to use PHP code for output).
2. don't use image field - use "Customfield: PHP Code". it will provide for you $data variable with $data->nid. after u can use what you want. my example:
<?php
$im = node_load($data->nid);
print '<a href="/' . $im->images['preview'] . '" class="thickbox" rel="a1"><img src="/' . $im->images['thumbnail'] . '" alt="' . $im->title . '" /></a>';
?>
rel="a1" - for grouping images for thickbox ( "prev,next,close" buttons )
#3
Reassigning to Thickbox to get advice from the maintainer about how to provide the proper output.
#4
I'm changing the status back to 'active' as I've just run into the same problem and, to me, installing another module to enter PHP code is a workaround, not a fix (but I'll let the maintainer decide the status after this). This might also merit being split off to another issue because, although the problem with Views is the same, I'm seeing it with the Imagefield module, not the Image module.
The problem is that, when using Views to create a gallery of images (in my case linked by node-reference to a parent node), the Thickbox module sets the 'rel' attribute using the Node ID. Since the images are stored in Imagefields in different nodes, they are all assigned a different gallery attribute, so the prev/next paging doesn't work in the Thickbox. I guess I could set the 'Image field options' to 'all', but if I have more than one gallery on a page, that could get confusing.
Looking through the code, the gallery attribute is set in the 'thickbox_field_formatter' function and, by the time the image item gets there, the Views context has been lost. So now I'm wondering whether this is really a Thickbox issue, or whether it needs to be tackled from the Views end, but it will probably get more attention here.
I've also seen some suggestions (http://drupal.org/node/162045#comment-741733) that the Thickbox JS could be modified to workaround this, by modifying the 'rel' attribute once the page is loaded and the Views context can be established via the DOM (although the linked comment refers to 'thickbox_auto.js' which is only loaded when the 'Image' module is installed).
Ideally, there would be a way - using the UI - to assign all images in the same Views display to the same Thickbox group.
There seem to be two approaches:
- Find a way to supply the Views context to the CCK formatter, so that the gallery attribute can be correctly set,
- Modify the JS to look for Views galleries and modify the incorrectly grouped gallery attribute on page load (by modifying/duplicating the thickbox_auto.js?).
#5
Thickbox uses the "rel" attribute of the link tag to determine how images should be grouped. All with the same value are grouped as one gallery.
Galleries are nodes in the image module, are they not? If that is the case I would recommend setting the "rel" attribute to
rel="image-gallery-[nid_of_image_gallery]"
e.g.
rel="image-gallery-123"
Then Thickbox will group all images in a gallery and user get the Next/Prev navigation etc.
If it not possible to do this with Views I certainly would welcome a rewrite of the "thickbox_auto.js" script.
I have never used the image module myself so all the code for it in theThickbox module has ben contributed by other users.
#6
Hi,
I see you moved this issue back to the Image module queue, but I'm seeing the problem with CCK/Imagefield and Thickbox, so should I open a new (very similar) issue, or does it make more sense to widen this issue a little to encompass both Image and Imagefield modules when used with Views and deal with it in the Thickbox queue?
The problem I'm seeing is as follows: In the Thickbox configuration options, grouping is set to 'by post' (grouping by 'page' creates problems when I have more than one thumbnail gallery on a page). I've embedded a Views block in the page with thumbnails of 6 images, pulled from 6 different nodes related to the current page. The Thickbox code is working, but the link around each image is set to a different group because of the Node ID - e.g:
Image 1: rel="image-gallery-541",
Image 2: rel="image-gallery-542",
Image 3: rel="image-gallery-543",
etc
... so each image is seen as a separate group, and the paging doesn't show up.
The thickbox_auto.js seems to do the trick for the Image module, but there's a lot of code in there specific to Image derivatives for the different sizes, which wouldn't be appropriate for Imagefield/Imagecache. So, one solution might be to modify, or duplicate, the thickbox_auto script to look for Imagefield fields or Views groups, but the example I saw made a lot of hard-coded assumptions about naming.
One workaround is to use Views theming to set appropriate classes on any image galleries so that the rel attribute can be modified by JS on page load to put put all the images in that View into a group, but that makes a lot of assumptions about naming, so it seems a bit fragile.
An alternative might be to add an option to group galleries 'per View', but that would require sending information about the View through to the CCK formatter so that the Thickbox theme functions can use it (and I don't know Views/CCK formatters intimately enough yet to work out where this can be done). Ideally I'd like to see an option to group 'by View' in the Thickbox configuration, which would use the View name as the grouping attribute, so if anybody can point in the right direction as to where this needs to be done (Views handler, CCK formatter, Imagefield module?), I'd be happy to try and help.
#7
I have thickbox_auto.js attaching behavior to "ul.images" but the gallery image view is publishing <ul class="image">. Note the "image" vs. "images" what should I change and where?
#8
There is a UL class="images" inside the View.
#9
I'm afraid, but this is not something we're going to fix on Image module's end.
However, if I'm not mistaken, the Views integration might allow to customize the output.