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

roger6106’s picture

I'm interested in this as well.

Mark Theunissen’s picture

Yes 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.

roger6106’s picture

It 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:

 if ($teaser)
    {
      print $node->field_picture[0]['view'];
    }
    else
    {
      print $content;
    }

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.

Mark Theunissen’s picture

Status: Active » Closed (fixed)

Great!

qtrimble’s picture

Regarding 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?

Mark Theunissen’s picture

You're on the right track. What is not working??

qtrimble’s picture

I'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?

Mark Theunissen’s picture

In 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.

qtrimble’s picture

I 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:

<?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

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.

qtrimble’s picture

I 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:

<?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

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.

Mark Theunissen’s picture

Try 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)

dom_b’s picture

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?

Ela’s picture

"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!!! :)

ilw’s picture

Why 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!

julianna’s picture

This is how I did it without any modifications to templates:

Output

  • Teaser shows a single image, linking to the node
  • Full node shows the Lightbox image, and not the single teaser image

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

  • Disable galleria warnings
  • Configure everything else as desired

Lightbox configuration

  • configure as desired

Content Type configuration

  1. Create new content type or edit existing content type for Galleria
  2. Under Workflow settings, change Attachments and Galleria from attachments to Enabled
  3. Under Manage Fields, add a new field with the type File, Image
  4. Configure the behaviour of the new field as desired (note: this is where you would change the settings for the image size for the teaser; scale down to thumbnail size if desired)
  5. Under Display Fields, change the Image Field settings to:
    • Teaser: Image linked to node
    • Full node: hidden

Usage
When creating a new Galleria page:

  • Upload the image for the teaser to ImageField
  • Upload the Lightbox/Galleria images to File Attachments
  • Use of the teaser/break tag is optional (follow standard procedures for your setup)