I can't display more than one cover image for projects overview

Hi Community :slight_smile:

I make a Projects overview page. I took the base of the Portfolio example in the doc but with some modifications.
I’m trying to display multiple cover images per project. But here is the problem, I have several images which is displayed but it is the same which is repeated.

My Cover section in the project blueprint:

  cover:
    type: files
    headline: Covers
    layout: cards
    info: "{{ file.dimensions }}"
    template: cover
    max: 4

<?php foreach ($page->children()->listed() as $project): ?>
<li>
  <a href="<?= $project->url() ?>">
    <?php foreach($project->images() as $image): ?>
      <?= $project->images()->findBy("template", "cover") ?>
    <?php endforeach ?>  
    <h1><?= $project->title() ?></h1>
  </a>  
</li>
<?php endforeach ?>

I also give you an image of the panel and one of the results:


Thanks for your help and sorry for my broken English :sweat_smile:

You’ll have to output the image URLs for each File object in that collection (and the template filter should be part of the object you loop over):

<?php foreach ($page->children()->listed() as $project): ?>
<li>
  <a href="<?= $project->url() ?>">
    <?php foreach($project->images()->filterBy("template", "cover") as $image): ?>
      <img src="<?= $image->url() ?>" alt="">
    <?php endforeach ?>  
    <h1><?= $project->title() ?></h1>
  </a>  
</li>
<?php endforeach ?>
1 Like

Alright, It works :slight_smile:
Thank you very much for your help and explanation.