Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I learned you shouldn't use Galleria in the teaser, but how can I show a teaser image? I'm using Galleria together with the imagefield and can only show no image or all images. I can't figure out how to show a single thumbnail.
Also, I would like to do the same on a views-page. That is: create a view on all galleria-nodes and show a title, description and a thumbnail. I hope someone can explain if and how this can be done.
Comments
Comment #1
roger6106 CreditAttribution: roger6106 commentedI'm interested in this as well.
Comment #2
Mark Theunissen CreditAttribution: Mark Theunissen commentedYes this is certainly possible:
- Create a template file for the Galleria node type. node-galleria.tpl.php or something similar.
- In the template, you want to check if the $teaser variable is set. If so, output the 'view' of the CCK field:
print $node->field_galleria_images[0]['view'];
Note how I'm outputting the first image only (index 0).
- In your node type's 'Display fields' setting you can set the imagecache preset, link action, etc.
Comment #3
roger6106 CreditAttribution: roger6106 commentedIt took me a while, but I got it working. I am using imagefield with Galleria. Here's the steps I did:
Copy the node.tpl.php file in your themes folder to node-[galleria content type].tpl.php.
I then changed:
print $content
to:
Note: change the "field_picture" to whatever your picture field is called. Go to your content types, and click "manage fields" on your Galleria type. Use the field under the name column instead of "field_picture".
Then click on the "Display Fields" link, and set the teaser to "Image", "Image linked to Node", or one of your image cache presets.
Comment #4
Mark Theunissen CreditAttribution: Mark Theunissen commentedGreat!
Comment #5
qtrimbleRegarding the approach user pvanderspek described in the opening post - this is exactly what I am also after. I would also like to "create a block view on all galleria-nodes and show a title, description and a thumbnail". In addition I am adding the block view to a panel region for a front page preview. According to the posts above, I would be able to use a custom template to achieve this but I'm puzzled as to how to structure the template file name. I've tried node-[galleria content type name].tpl.php and block-[block view name].tpl.php with the suggested code block from user roger6106 from above. Has anyone achieved something like this?
Comment #6
Mark Theunissen CreditAttribution: Mark Theunissen commentedYou're on the right track. What is not working??
Comment #7
qtrimbleI'm not actually seeing the title and thumbnail on the panels page so I've concluded that i was using the wrong template file. Since this content was inserted as a block view, do I customize a block template file or a view template file? Also, what do I use for the template name?
Comment #8
Mark Theunissen CreditAttribution: Mark Theunissen commentedIn the views interface, you can see the template files that will be used, it's one of the options. It tells you exactly what to name them, and indicated which one it currently is using ... check the views documentation for more info.
Comment #9
qtrimbleI made a copy of views-view.tpl.php and renamed to views-view--Gallery--block.tpl.php. If I were use the code that roger6106 suggested, I would need to modify the node-Gallery.tpl.php file and that would be applied to generally-in other words, I only want the block to have the title and the teaser thumbnail, I do not want to modify the entire node.
Anyhow, the code I believe I need to modify occurs in this snippet:
Can you provide a reference to some documentation which tells me what is contained in the $rows variable? I have read about devel functions that provides this info but I have yet to implement the function successfully.
Comment #10
qtrimbleI made a copy of views-view.tpl.php and renamed to views-view--Gallery--block.tpl.php. If I were use the code that roger6106 suggested, I would need to modify the node-Gallery.tpl.php file and that would be applied to generally-in other words, I only want the block to have the title and the teaser thumbnail, I do not want to modify the entire node.
Anyhow, the code I believe I need to modify occurs in this snippet:
Can you provide a reference to some documentation which tells me what is contained in the $rows variable? I have read about devel functions that provides this info but I have yet to implement the function successfully.
Comment #11
Mark Theunissen CreditAttribution: Mark Theunissen commentedTry doing a var_dump($rows) to see what's in it.
If you have the devel module switched on, you can do a krumo($rows)
Comment #12
dom_b CreditAttribution: dom_b commentedcan this be added to the module permanently? something like 'Galleria Teaser' option under display fields? I would love just to be able to display a random image from the galleria in the node teaser. I think this would help a lot of people out as there is no easy way to add a teaser image, or is there?
Comment #13
Ela CreditAttribution: Ela commented"can this be added to the module permanently? something like 'Galleria Teaser' option under display fields? I would love just to be able to display a random image from the galleria in the node teaser. I think this would help a lot of people out as there is no easy way to add a teaser image, or is there?"
That feature would be great!!! :)
Comment #14
ilw CreditAttribution: ilw commentedWhy don't you simply use the built in views feature called "Group multiple values"? it allows you to display only the first or the last image added to the gallery!
Comment #15
julianna CreditAttribution: julianna commentedThis is how I did it without any modifications to templates:
Output
Note that this option requires that you use ImageField to handle the teaser image and Drupal's attachments to handle Galleria images
Modules installed
Galleria configuration
Lightbox configuration
Content Type configuration
Usage
When creating a new Galleria page: