By Lostmonkey on
Hi,
I am making a gallery using CCK + Imagefield + Imagecache + Views. I use the thumbnails created by Imagecache on the overview pages, but I haven't figured out how to make the thumbnails link to the image node.
Can it be done?
Thank you,
Mikkel
Comments
This link should give you
This link should give you some general idea -> http://drupal.org/node/42597
Basically, you can theme your output in View page for each particular field.
uups
wrong here...
You might also want to check
You might also want to check out the thickbox module, which does (very nice) javascript image popups with CCK/imagecache.
I agree that the
I agree that the thickbox-module does a very nice job indeed, however it is not quite suitable for the way I have set up my gallery system.
I prefer being able to click on the thumbnail images and then be taken to the node itself, which contains some descriptive text and terms.
The solution probably lies in theming the view. Unfortunately I am having a hard time making sense of the 'Theming with Views' chapter in the handbook, and am hoping someone can guide me ... ?
It looks a bit too much of
It looks a bit too much of code in the instruction. I ran into the same problem as you that I don't really want to see that much of code. I'm not an expert here and know not much about code. Anyway, I will say from what I understand.
1. Just go to Theme Wizard. Then, choose view that you want to theme. (Theme Wizard can only theme "List View") Choose "Simple List" Then, Click at "Select Theme Type"
2. Wizard will generate 3 types of code for you.
2.1 The first one goes into template.php which is under your theme directory. (If you don't have it, just create a new file.)
2.2 The second and the third one has to be on their own files. (Put them in the theme directory also.) So, create a new file with the name said above the box and copy the entire code into that file. (Second file will end with ".tpl.php", the third file will end with ".css")
3. Back to Step one again. Follow the step but instead of click at "Select Theme Type", Click at "List Theme Fields"
4. The first box will give you the function name for all fields in the view. The second box is an example of the code to theme. Just copy the second box and paste into "template.php" file which is the same file you created it in step 2.1. Change the code to match what you need.
So, what you have to pay attention is in step 4 that you can theme field to whatever you want. I don't know if it's possible to skip all steps and go to step 4 directly. Never try that.
Hope this help,
Hmm ... I will have a look
Hmm ... I will have a look at that. However I am using the 'Bonus: Grid View', so I guess I will not be able to use this method ?
Mission impossible?
Having now explored the theming option a bit, I starting to worry this is a mission impossible.
I thought it would be fairly simple to make the thumbnails clickable, but having searched the forum it now looks like a very difficult task.
So if anyone knows how to do this, please step forward.
:-) Mikkel
*bump*
No?
I haven't tried the theme
I haven't tried the theme wizard.
Have you tried posting a feature request to the imagefield issue queue asking for an "as link to node" option in cck display fields and views?
try this:
I think you may find some help by reading http://drupal.org/node/101748#comment-179645
I think this directly addresses the issues you are having. Hope it helps.
I have to get this working also...
After a few days of hard working to get this running, I'm on a dead-end.
I also tried this link (http://drupal.org/node/42597) an many, many others...
I hope there is an easy and working solution for this.
Link to node under imagecache-generated image from custom View
I'm back from the woods where I couldn't see the trees anymore. I thought I had a simple wish, but i can't seem to figure it out.
This is the situation: I have made a view where a single nodeteaser is displayed and assigned it as my frontpage. I used CCK to make an imagefield, which I obviously use to upload pictures. With Imagecache I made to presets; one for the teaser, one for in the main article. The problem is that I want to link the teaser-image to the node it belongs to, so visitors can read more. How do I customize this view?
Here's a screenshot with comments: http://drupal.org/files/issues/drupalissue.jpg , which I hope clarify things for you. Excuse my bad paintskills. ;)
(Excuse the crossposting from http://drupal.org/node/139386 , I hope this is a better place)
Maybe not the "cleanest" solution
Maybe not the "cleanest" solution, but it works.
My node-anymals.tpl.php:
Note: since i use imagecache, I must use the $node->vid (instead of $node->nid) for linking to the full node.
Thanks for your comment!
Thanks for your comment! Although it's not what I'm looking for. I already have a "read more" link in the teaser.
I want to link the by imagecache generated thumbnail to the full node.
The thumbnail "magically" appears in my teaser, so I can't seem to figure out how to link this thumbnail to the full node.
An example...
Let's say you have a field genereated with CCK called "field_imagecache". This ist the field, where imagecache genereates the image.
In your *tpl.php you already should have someting like
<?php print $node->field_imagecache[0]['view'] ?>So this ist the image(cached) without a link.
Now change it to somethig like
<a href="node/<?php print $node->vid ?>"><?php print $node->field_imagecache[0]['view'] ?></a>Now you have an image(cached) with a link to the full node.
This is what I've done and it works like a charm.
Say what?
I should? I am using views to generate a page with the imagecache-images, does this apply to me as well? If so, would you mind elaborating on how I do this?
Thanks,
Mikkel
As far as I can see none of
As far as I can see none of my *tpl.php files have a line with imagecache in it. I use standard story node in which I have smply added a cck image field called image (with imagecache thumbnails). Presumably that means all that is being referenced in the tpl is $contents. can anyone point me to a typical tpl.php file that references imagecache?
custom theme functions
I think what you need to do is figure out which theme_ function is generating the image and anchor for you. This may depend on the modules you have installed. Below are two of the functions I modified to make them work the way I wanted in my site. The first function was found in modules/imagecache.module, while the second was found in modules/thickbox.module. I copied the original functions into my template.php file (themes/hhma/template.php) and replaced theme_ with hhma_, which is the name of my theme.
I created a 'Feature
I created a 'Feature request' over at http://drupal.org/node/144139 apparently the 'as link' feature should already be available in the dev-version, can anyone confirm this? I will try it myself once I get the chance.
It's all good
Now having tested it myself, I can say that using the dev-versions is the answer, it works. My Imagecache thumbnails are now clickable!
:-) Mikkel