Last image in each row stretched out

Created on 21 August 2023, over 1 year ago

The last image in every row of my test photo grid is stretched out horizontally -- i.e. aspect ratio is not preserved.

How do I stop that from happening? I've tried different image styles and different settings for the max row height in the views config for the photo grid. It looks like the dimensions of all images, including the last image in each row, are set in an element style by the module.

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States brianbrarian

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @brianbrarian
  • πŸ‡ΊπŸ‡ΈUnited States brianbrarian
  • πŸ‡·πŸ‡΄Romania martonlaci

    Hi,
    I had problems with the stretched images too, but I was convinced that this problem was not present in versions before 2.0.
    After compared the old source with the current one, the only noticeable difference was in

    views-photo-grid.js

    gridRow createItem function line: 125, this.items.push(item); was called after this.adjustRowHeight(item.height);
    Inserting some console logs, I noticed that in each row the first image width is added twice to the usedWidth.
    Since the adjustRowHeight recalculates the row usedWidth in my opinion its enough to calculate only in the other part of the if.
    This small modification solved my stretched images problem.
    Attached a small patch with this modification.

  • πŸ‡ΊπŸ‡ΈUnited States brianbrarian

    @martinlaci Thanks! Your patch in #3 works for me. Much better than the hack I was using.

Production build 0.71.5 2024