Hey, I just tried this module and I love how it implements images and slideshows.
I have one request though.
How about optionally letting the image pass through ImageCache first? This is especially useful for me to keep the image height static, so the extra image slideshow/selector below the actual image doesn't move if the height of my images vary.
A workaround is to do some work on the images prior to uploading, but having the option of using ImageCache is more user-friendly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hedac’s picture

subscribing
maybe it would be easier to use Imagefield instead of upload module.

gallamine’s picture

I agree with hedac & silvercat. ImageField is better. It displays a thumbnail after upload. Using ImageCache would make my life easier.

fallsemo’s picture

Subscribing.
Completely agree.

Mark Theunissen’s picture

Status: Active » Closed (won't fix)

You can do this quite easily I would imagine, by hooking into the _preprocess function. Here is the original:

/**
 * Preprocess the galleria variables.
 */
function template_preprocess_galleria(&$vars) {
  $node = $vars['node'];
  $files = $node->files;
  $images = array();
  $i = 0;

  foreach ($files as $file) {
    $caption = $file->description != $file->filename ? $file->description : '';
    $images[] = array(
      'data' => theme('image', $file->filepath, $caption, $caption),
      'class' => $i == 0 ? 'active' : '',
    );
    $i++;
  }

  $attribs = array(
    'class' => 'gallery clear-block',
  );

  $vars['next_prev_links'] = '<a onclick="$.galleria.prev(); return false;" href="#"><< previous</a> | <a onclick="$.galleria.next(); return false;" href="#">next >></a>';
  $vars['gallery'] = theme('item_list', $images, NULL, 'ul', $attribs);
}

It calls theme('image'), just override that in your template.php, and use theme('imagecache','preset',...,...) instead.

Mark Theunissen’s picture

As for using Imagefield instead of upload.module, the answer is "not until it's out of alpha"!

sk_mamp_nb’s picture

Hi Mark,
This is a great module but I have not been able to utilize its potential even partially.
So far I've only been able to get the images in a modal lightbox which have to be manually skipped from one to the next but I don't get any automatic slideshow.
Is there some place where I could see a step by step 'how to' or a tutorial for implementing a slideshow using Galleria?

I also have this problem that galleria shows the original images as uploaded rather than the size I specify in the theme function. I guess using the imagecache will sort this out but I don't know how to apply the _preprocess hook. I tried adding the code into my template.php but it complains that it 'can't declare the function again' since it has already been declared in galleria.module so how do I override this function in my template.php?

Besides this, adding the theme function to the node body itself creates a strange result for me: it pops-up a lightbox with the thumbnails in it. It works fine if it is called from another page.

Many thanks,

Sanjay

Mark Theunissen’s picture

Hi Sanjay

There is no automatic slideshow function, the modal lightbox that you describe is the correct functionality.

The size specified in the theme function is the size you want the lightbox, not the images.

You can't just add the function into your template.php, please read the Drupal Theme Guide for info on how to theme module output in Drupal 6. Preprocess hooks are pretty standard.

You shouldn't add the theme function to a Galleria's node body. It should always be called from another page. Why do you want to display a Galleria and a link that opens the same Galleria in a Lightbox on the same page?

sk_mamp_nb’s picture

Thanks Mark.

My mistake, I had misunderstood http://drupal.org/node/352081#comment-1181969 in terms of placing the theme function in the node body.

I'll read the Theme Guide.

Rosamunda’s picture

Sorry if this isn´t the place to ask this (I didn´t want to add an extra issue because I think it´s pretty much related), I´m trying to use this module right out of the box (no lightbox).
As it´s not possible to make it compatible with imageCache, is there a way to set the size of the big image that shows when you click on each thumbnail?

Thanks!!
Rosamunda

Mark Theunissen’s picture

Status: Closed (won't fix) » Active

You can use imagecache, but it requires a bit of programming (basic stuff). I'll re-open this issue, and the next time i look at Galleria, I'll see if I can make a user-friendly imagecache integration.

Rosamunda’s picture

THANKS!!

kahara’s picture

go to Admin > Site Configuration > File Uploads. Here you can set the maximum height / width for uploaded images.

iaminawe’s picture

I agree that imagefield and imagecache integration would turn this from a cool module into a really great and even indispensable one.

I have found info on theming the output of imagefield with multiple pics attached but dont think I have seen one that displays this slickly.

subscribing...

DRScales’s picture

I did this straight in the module for now, as I have a limited requirement.

Instead of foreach ($files as $file) {you would need to provide a forech statement like

 foreach((array)$node->field_YOURCCKFIELDNAME as $file) { 
$thepath = $file[filepath];
$thedesc = $file[description];
$thename = $file[filename];

in order to cycle through the array of arrays. The next problem is to call image cache for your galleria (as your display settings for your content type are probably needing to exclude your CCK Imagefield from display). As they don' t get called through drupal with the current 'data' line

  $caption = $file->description != $file->filename ? $file->description : '';
    $images[] = array(
      'data' => theme('image', $file->filepath, $caption, $caption),
      'class' => $i == 0 ? 'active' : '',
    );

, and so don't get created

we need to change it to

    $caption = $thedesc != $thename ? $thedesc : '';
    $images[] = array(
      'data' => theme('imagecache', 'YOURIMAGECACHESETTING',  $thepath, $caption, $caption),
      'class' => $i == 0 ? 'active' : '',
    );

This will allow image cache to process each image into the required size (YOURIMAGECACHESETTING) otherwise it just might not be ready!.

Now, the next trick is to alter the module to include options within the config page to accomodate this as a variable. Or, better still, as an option in each item type's settings. I think this is basically next on the tasklist for the Galleria module (possibly followed by some count and title attributes) so I'll park my effort here here unless anybody wants further.

Mark Theunissen’s picture

Thanks for the input! One day I will get around to making Version 2 of Galleria, and when that day comes, this will help.

smithn.nc’s picture

Mark,
I needed this functionality for a client, so I went ahead and added it in, along with settings to choose which imagecache preset. This patch is for imagecache functionality only. I left out imagefield integration; picking my battles, I guess. :)

Edit:
Forgot to say thanks to DRScales for the big head start getting something together. Also, reiterating again, don't use this patch, use the one below this post!

smithn.nc’s picture

Version: 6.x-1.0-beta1 » 6.x-1.0-beta2
Status: Active » Needs review
FileSize
2.87 KB

Whoops! Please disregard the first patch and use this instead. I had the old one doing something goofy when reading/setting the selected imagecache preset, which would break the output if the module was used before settings were saved in the admin area.

Mark Theunissen’s picture

Status: Needs review » Fixed

Thanks, commited to DRUPAL-6--1!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.