Closed (fixed)
Project:
Colorbox
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2010 at 19:32 UTC
Updated:
30 Apr 2010 at 06:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
frjo commentedThank you very much for contributing all these Image module integration improvements!
I don't use the Image module myself so I depend on people like you.
How well tested is this?
Comment #2
recrit commentedi have had it working on a development site with no issues. ColorBox uses the correct derivative setting when linking the image-attach-body. I believe thickbox linked the gallery thumbnails too, so that's a possible addition to the javascript.
Comment #3
recrit commentedhere's a re-roll with added support for image galleries -
ul.images a, added to js/colorbox_image_module.jsComment #4
frjo commentedI have now tested your patch and it seems to work well. I have made some adjustment that I hope you have time to look at and test.
* Some minor naming changes.
* Replace
$("a[rel='image-gallery']", context).colorbox();with simply adding a colorbox class with$(this).addClass('colorbox');* Make colorbox_image_module.js load before colorbox.js, so the above work
* Some performance improvements in colorbox_image_module.js, mainly .image-attach-body -> div.image-attach-body selector, and adding initColorboxImageModule-processed check.
* Adding the image title to the image link so it shows up in Colorbox
If it works well for you I will commit it and make it part of the beta 3 release.
Comment #5
frjo commentedComment #6
recrit commentedI've tested and everything works, thanks!
I'm still tossing around the lines below from my original js code.
This makes sense since when dealing with a gallery or image attach because all the images are the same derivative. But if the images on the page are mixed derivatives - example: thumbnails, original, preview -- then the original and preview's won't get colorboxed and won't show up in the colorbox gallery slides. Removing these lines can eliminate any of this confusion.
Comment #7
recrit commentedChanges to patch:
Comment #8
frjo commentedI added some comments, replaced "_original" with IMAGE_ORIGINAL like in the Image module and added/removed a couple of spaces.
Give an OK to it and I will commit it.
Comment #9
recrit commentedI believe its OK to commit in this state. This is obviously a weak link with the image module which results in these crazy auto js files...
Some things to note about colorbox_image_module.js :
settings.image_derivative + '.' + extension... I don't believe this extra work is needed since the original image is most likely the largest.Comment #10
frjo commentedCommitted to 6-dev. Thanks again for this excellent contribution to ColorBox!
You are right that the whole colorbox_image_module.js is a bit of a hack. It would be a lot nicer if the Image module could add some Colorbox/Lightbox2 etc. integration.
Comment #11
recrit commentednot sure on the etiquette but you could override the image modules theme function all together.... for maintaining you would have to keep up with releases of image module.
I have tested with the code below and it will link the colorbox anywhere image calls theme('image_display'), ie this even works for custom views or anywhere for that matter.
This would go into the colorbox.module:
Comment #12
kiwi_steve commentedJust a thought: Isn't the image module one of Sun's babies? Wouldn't it be better to talk to him (& include him?) and work something out rather than create a cludge that will probably break at some point through the simple fact that he doesn't realise you're working around certain aspects of his module.
Having this work with the Image module is one of the single most-important features for this module IMHO... so I would like to see it developed in the right direction with the right support from the right people - so far so good.
And I'd like to thank everyone who's working on this module - its made a huge difference to the presentation of a couple of sites I'm working on, and I'm learning a bit about how stuff works behind the scenes by reading these posts and trying to follow the code.
2 thumbs up :)
Steve
Comment #13
recrit commentedtheme override in #11 causes problems with img_assist and would need to have some conditions before applying the link, ie check if arg(0) == 'img_assist'... this could turn out more troublesome than the js method...
thoughts?
I'm all for a cleaner way of doing this, but from past issues it looks like thickbox was forced to do it this with js.
Comment #14
frjo commentedI don't think it’s a good idea to include a theme override in another module. An option is to have instructions in the README so users can do it in their own themes.
There are a setting "Deactivate Colorbox on specific pages" and by default it includes "img_assist*".
The absolutely best would of course be native support built in to the Image module.
I suggest that you who are using the image module and Colorbox module contact joachim and sun and talk about this. Start by making a feature request in the issue queue for the Image module.
http://drupal.org/project/issues/image