I am trying to get the first and then the second image of my block but the following code doesn’t work:
<?php foreach ($block->images()->toFiles() as $image): ?>
<?= $image->nth(1) ?>
<div class="image-number">
<?php if ($block->imageTag()->isNotEmpty()): ?>
<p>
Abb. <?php echo $imageCounter?>
</p>
<?php endif ?>
</div>
<?= $image->nth(2) ?>
<div class="image-number">
<?php $imageCounter++; if ($block->imageTagTwo()->isNotEmpty()): ?>
<p>
Abb. <?php echo $imageCounter?>
</p>
<?php endif ?>
</div>
<?php endforeach ?>
I also tried:
<?= $block->images()->nth(1) ?>
Whats wrong about it?