Hi,

I've looked for a simple cck imagefield gallery formater for quite some time now! This is great! Some more options or themes and this is a killer module. :-)

So to my problem. I'm adding some images of different width to my node. Depending on which I order I have them sorted in the gallery gets different widths! If I have a thin image first then I won't see the wider images in full. The width should be set to the widest image's width. Of course no problem if your images are of the same width.

Thanks again for a wonderful module!

MrVictor

Comments

MrVictor’s picture

Priority: Normal » Minor

I found I could easily set fixed values in the tpl.php-file to solve my problem. Not a great way but it works.

manuel garcia’s picture

Yup, this is how it's supposed to work. Unfortunately in order to prevent this, we'd have to get every image's dimensions, figure out which one is the widest, and use that width. This would mean a lot more expensive processing, and is not something I'm willing to do because of this.

The way to work around it is how you did it, or setup your imagecache preset so they all get the same dimensions.

manuel garcia’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

topdillon’s picture

Good idea. Here is another angle.

I know what my widest image width is, I set it to a maximum of 300px.
I don't know which image will be shown first, could be 200px, could be 300px.
So I should have an option to set it to a specific width, if I know what maximum width I want, which in my case I actually do.

Reasonable request?

tomhung’s picture

Version: 6.x-1.0-rc3 » 7.x-1.0
Category: support » feature
Status: Closed (fixed) » Needs review
StatusFileSize
new2.38 KB

Here is my patch (7.x-1.0) to statically set the slide Width and/or Height. This is useful for cases where the images are mixed portrait and landscape and you don't want to crop.

nicxvan’s picture

Tomhung I patched my gallery formatter and it works great now. Thanks

pbfleetwood’s picture

Is there any chance that the patch in #6 will be added to this module?

antony.lovric’s picture

StatusFileSize
new506.17 KB

I've encountered this same isue and wrote a small work-around in the .module file and the .css style.

In the .module code, around the '// Get the dimensions, and remove unfound files,' comment, I create local variables that represent the max height and width of the images that will be shown. (There is already code that iterates through and transforms the images in galleryformatter_getimage_dimensions)

  // figure out the max width and height
  $maxWidth = 0;
  $maxHeight = 0;
  
  // Get the dimensions, and remove unfound files,
  // to avoid errors when the image is no longer on the server but still in the image field.
  $changed = FALSE;
  foreach ($items as $delta => $item) {
    
    $dimensions['slides'] = galleryformatter_getimage_dimensions($settings['slide_style'], $items[$delta]['uri']);
    if (!$dimensions['slides']) {
      unset($items[$delta]);
      $changed = TRUE;
    }
    else {
      $maxWidth = max($maxWidth, $dimensions['slides']['width']);
      $maxHeight = max($maxHeight, $dimensions['slides']['height']);        
    }
  };

  // then later on
  //$dimensions['slides'] = galleryformatter_getimage_dimensions($settings['slide_style'], $items[0]['uri']);
  // use the max, not the first image's dimensions
  $dimensions['slides']['width'] = $maxWidth;
  $dimensions['slides']['height'] = $maxHeight;

Then in the style sheet I altered some components to have the alignment fixed so images in the slideshow are centered in the (now) larger preview area.

Here's a preview of the changes, originally the second image only displayed 189px wide (the width of the first);

Preview of potential fix.

knalstaaf’s picture

Issue summary: View changes

A quick workaround is adding the following code to a stylesheet of choice:

.galleryformatter .gallery-thumbs{
    width: auto !important;
}
c470ip’s picture

@antony.lovric
Perfect! Worked for me like a charm, thanks. Before that I had to manually set fixed thumbnail width in galleryformatter.js, though this led to distorted thumbnail carousel.

astonvictor’s picture

Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks