How to insert an img class in a list of images

Hi,

I am building a template with a list of blog entries:

    <?php foreach($articles = $page->children()->listed()->flip()->paginate(6) as $article): ?>
        <div>
          <a class="link" href="<?= $article->url() ?>"><h2 class="blog-header"><?= $article->title()->html() ?></h2></a>
		  <div class="date"><?= $article->published()->toDate('%d. %m. %Y') ?></div>
		  <?= $article->image() ?>
          <p class="text"><?= $article->text()->excerpt(300) ?></p>
          <a href="<?= $article->url() ?>" class="more-button">Mehr lesen</a>
        </div>
		<?php endforeach ?>

what works so far. My question is how to put an unique img class inside the image selection.

Thanks Stefan

You have full control over the image tag if you don’t echo the image:

<?php if ( $image = $article->image() ) : ?>
  <img alt="<?= $image->alt() ?>" class="whatever" src="<?= $image->url() ?>"  />
<?php endif; ?>

Good morning and thank you! It works (but I need to define $image instead of $images):

<?php if ( $image = $article->image() ) : ?>
  <img alt="<?= $image->alt() ?>" class="whatever" src="<?= $image->url() ?>"  />
<?php endif; ?>

Regards Stefan