By jacobmn on
So I've used Imagecache on a few sites and it's great. The one thing I cannot, however, figure out is how to have a content type use more than two derivatives (say, a thumbnail for teaser and full size version on the node itself). I would like a third, larger version of that same image so that I can invoke a jquery modal window that will display this third version when the user follows a link.
I understand how to make everything else happen within a CCK node template file, but I am not sure how to make the third derivative show up without creating a seperate field for it, which would mean making the user upload the same file twice.
Any ideas would be highly appreciated.
Comments
the lightbox2 module comes
the lightbox2 module comes close to this with lightbox functionality.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Thanks for your reply. So
Thanks for your reply. So are you saying that imagecache does not offer the functionality to have many derivatives of the same pic? I would much rather use a different plugin than lightbox, so a custom setup would be much better. All I would need to figure out would be how to display a third derivative of my imagecache and I could set up the rest.
Ignore me if I am just being annoying :-)
no you're not being
no you're not being annoying. sorry i should have been more clear-- you can create as many imagecache presets as you like. By default, you can choose different presets for teaser and full node without any coding. If you wish to use more presets, the README.txt file for imagecache contains the syntax for using the theming function.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Thanks much again for your
Thanks much again for your help, I really do appreciate it. I will post my results for the benefit of others if I come up with a nice solution.
LightBox and ThickBox
The LightBox and ThickBox modules will automaticaly handle the JQuery portion of your request. I mention just in case it was specifically LightBox that you weren't interested in.
An example is the photo near the top:
http://www.sunflowerchildren.org/projects/americassouth/brazil/brincader...
-------------------
http://www.PrivacyDigest.com/ News from the Privacy Front (Drupal)
http://www.SunflowerChildren.org/ Helping children around the world ( Drupal)
Thickbox + template.php solution
Well, to assist anyone else who might search for this... I ended up using the Thickbox module, which by default uses the original uploaded image, which is too big for my taste. So I found this code snippet to add to my template.php file which makes Thickbox use a specific imagecache preset. This may not be all that flexible because if I want to use this anywhere else on the site with a different preset, it may throw a wrench in my plans.
Anyhow, here is the code that goes in template.php, replacing THEMENAME and PRESET_NAME with your own information. I cannot for the life of me find the site / page where I got this from (closed the browser tab) or I would reference the original author.
since the ability to choose
since the ability to choose any preset you wish is built in with lightbox2, I'm curious why the choice of thickbox...
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
I didn't realize that was
I didn't realize that was available with lightbox, plus I never really liked the look of lightbox. I know it can be styled to fit my needs, but now that I think about it more maybe I was just being stubborn and should have gone for the lightbox... I may end up giving that a try now that I know it has that feature.
lol, i was just
lol, i was just curious...thanks.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Im looking for something similiar
My problem is similar but i need to display a list of imagecache derivatives for the user to download on the node for example: small, medium, large, extra large, original etc.
Does anyone know a way of doing this.
Much like how the Image module allows multiple derivatives to be setup and then it displays each derivative under the image as a click-able link which resizes the image to that size.
I'm really lost with this but i would have thought this functionality should be part of the imagecache or filefield module.
_
I would think you could do this by setting up a view to the list of derivatives then embedding that view into the node with a http://drupal.org/project/viewfield.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Sorry, i cant find away to
Sorry, i cant find away to load image cache presets into a view. Im not sure how putting a that view in a node would allow those presets to be applied to an image anyway. Plus that module is for drupal 5, im using 6
_
You just add the imagefield field multiple times (one for each preset you want to display) and select the appropriate imagecache preset in the configuration options for the field. You also need to add an argument of 'node: nid'. To get the preset to show as a link for download purposes, you'll need to theme the view to turn the url or path into a link.
The d6 version of viewfield should work, but if not you can always theme the view into the node.tpl.php file.
It's not trivial to do, but it's definitely possible.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
couldn't use that module
couldn't use that module anyway, so i used contemplate, It was easier than i thought
Well i decided to setup a
Well i decided to setup a content template and write some code which just links directly to the images in the imagcache folders, something like this: