Fetch first image of tagcloud

my request is quite strange and I have not found anything on the forum.

<?php 
          $tagPages = collection('photography');
          $tags = $tagPages->pluck('tags', ',', true);
          $images = $tagPages->images()->limit(1);


          foreach($tags as $tag): ?>
            <div class="pure-u-1 pure-u-sm-1-2 pure-u-xl-1-3 box-1">

              <a href="<?= url('photography', ['params' => ['tag' => $tag]]) ?>">
                <?php foreach ($images as $image) : ?>
                <figure>
                  <img src="<?= $image->url() ?>" alt="">
                  <figcaption>
                    <span>
                      <span><?= html($tag) ?></span>
                    </span>
                  </figcaption>
                </figure>
                <?php endforeach ?>
              </a>

         
            </div>
          <?php endforeach ?>

this is my code at the moment, but i would like to fetch the first image of the first tag, not the first image of the collection.
Obviously the problem exists because I can not take the parent of the plucked tags.
Can you help me? Thanks!

The only thing that I can image that would make sense is if you wanted to find the first image of the first page with the given tag? But then I don’t understand why you need the loop. Because a tag doesn’t have an image… Unless you have tagged your images.

<?php
$tagPages = collection('photography');
$tags         = $tagPages->pluck('tags', ',', true);

foreach($tags as $tag): ?>
            <div class="pure-u-1 pure-u-sm-1-2 pure-u-xl-1-3 box-1">

              <a href="<?= url('photography', ['params' => ['tag' => $tag]]) ?>">
              <?php // find pages with tags and get the first
                if ($image = $tagPages->filterBy('tags', $tag, ',')->images()->first()): ?>
                <figure>
                  <img src="<?= $image->url() ?>" alt="">
                  <figcaption>
                    <span>
                      <span><?= html($tag) ?></span>
                    </span>
                  </figcaption>
                </figure>
                <?php endif ?>
              </a>
            </div>
<?php endforeach ?>

because I’m an idiot and it was much easier than I thought.
thanks as always, texnixe!