{foreach from=$objects item='article' name='articles'}
<article class="contentItem contentItemMultiColumn" role="article">
<div class="contentItemLink">
- <div class="contentItemImage contentItemImageLarge" style="background-image: url({if $article->getTeaserImage()}{$article->getTeaserImage()->getThumbnailLink('medium')}{else}{$__wcf->getStyleHandler()->getStyle()->getCoverPhotoURL()}{/if})">
+ <div class="contentItemImage contentItemImageLarge">
+ <img
+ class="contentItemImageElement"
+ src="{if $article->getTeaserImage()}{$article->getTeaserImage()->getThumbnailLink('medium')}{else}{$__wcf->getStyleHandler()->getStyle()->getCoverPhotoURL()}{/if}"
+ height="{if $article->getTeaserImage()}{@$article->getTeaserImage()->getThumbnailHeight('medium')}{else}{@$__wcf->getStyleHandler()->getStyle()->getCoverPhotoHeight()}{/if}"
+ width="{if $article->getTeaserImage()}{@$article->getTeaserImage()->getThumbnailWidth('medium')}{else}{@$__wcf->getStyleHandler()->getStyle()->getCoverPhotoWidth()}{/if}"
+ loading="lazy"
+ alt="">
+
{hascontent}
<div class="contentItemBadges">
{content}
.contentItemImageSmall {
min-height: 75px;
+
+ .contentItemImageElement {
+ height: 75px;
+ }
}
.contentItemImageLarge {
min-height: 150px;
+
+ .contentItemImageElement {
+ height: 150px;
+ }
+}
+
+.contentItemImageElement {
+ margin: -10px -10px 10px -10px;
+ object-fit: cover;
+ object-position: center;
+
+ // The `100% + 20px` are the result of the negative margins.
+ max-width: calc(100% + 20px);
}
.contentItemBadges,
flex-direction: column;
}
+.contentItemImageElement + .contentItemBadges {
+ left: 10px;
+ position: absolute;
+ top: 10px;
+ z-index: 1;
+}
+
.contentItemOptions {
position: absolute;
right: 10px;