How to adjust image height in grid inside block?

    footer: grid(
      columns: (46cm - margin-left, auto, auto),

      block(
        width: 100%,
        fill: primary_color,
        outset: (left: 10000pt),
        radius: (top-right: 15%),
      )[

        #grid(
          columns: (auto, auto, auto),
          align: left + horizon,

          stack(
            dir: ltr,
            spacing: 40pt,
            image(height: 100%, author_image),

            stack(
              dir: ttb,
              spacing: 12pt,
              text(size: 22pt, weight: "bold", event_name),
              v(20pt),
              ..address_lines.map(x => text(size: 22pt, x)),
            ),
          ),
          h(50pt),

          block(inset: 1cm, fill: red, height: 100%, width: 100%)[#grid(
            align: left + horizon,
            columns: (auto,) * column_count,
            ..additional_images.map(x => image(x, height: auto)), 
          )
          ]
        )
      ],
      h(2cm),
      block(width: 100%, height: 100%)[
        #line(length: 100%)
        #v(-1cm) 
        #set text(size: 14pt)
        #if bibliography_name != "" {
          bibliography(title: none, bibliography_name)
        } else {}
      ],
    ),
  )

I have this footer, which should contain an array of optional images. I use a min(array.len(), 3) function to calculate column count. But when the images break to a second row, they clip outside of the block and look wrong. I can’t find a way to automatically fit them into the grid/block correctly.

Hello @Waldo,

thank you for posting a code snippet and providing a screenshot with your question. In order to get some support, would you please be able to edit your original code to ensure it compiles?

It does not at the moment as it contains some critical errors (missing #set page(... and some undeclared variables like

  • margin-left
  • primary_color
  • author_image
  • event_name
  • address_lines
  • …
    As a hint, you can replace your image() with rect() to make your code non dependent on external images.

Ideally, you would provide a minimum working example (MWE) to keep the focus on the issue at hand.

Typst guidance: For multi-word identifiers, the recommended case convention is Kebab case.

What would you like as an end result? That the images be resized automatically so they could fit on one row? Is there a maximum number of images? Are they all of the same size?

I uploaded the files to this repo: waldo/RPTU_Poster_Typst: RPTU Poster Typst Template - Forgejo: Beyond coding. We Forge.
The end result i would have expected is that the images scale according to the available space of the block i marked red, independant of how many images there are :thinking: