Platzhalter-Avatar: AdobeStock-Frauenavatar (von alter Seite, lokal optimiert 11 KB) statt Initialen-Fallback

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 22:28:51 +02:00
parent d757fe1043
commit 51149e8c5f
3 changed files with 4 additions and 43 deletions

View File

@@ -5,16 +5,11 @@ declare(strict_types=1);
/**
* Visitenkarte für eine Person. Props:
* $person array{department, name, phone?, email?, image?}
* Ohne image rendert die Karte einen geschlechtsneutralen Initialen-Avatar
* (Coolvetica-Initialen + Logo-Wasserzeichen) — keinen Foto-Platzhalter.
* Ohne image greift der Platzhalter-Avatar (img/persons/platzhalter.jpg).
* Kontakt-Link: phone → tel:, sonst email → mailto:.
*/
$image = $person['image'] ?? null;
$initials = implode('', array_map(
static fn (string $word): string => mb_substr($word, 0, 1),
array_slice(preg_split('/\s+/', trim($person['name'])) ?: [], 0, 2)
));
$src = $image ?: 'img/persons/platzhalter.jpg';
if (!empty($person['phone'])) {
$contactHref = 'tel:' . preg_replace('/[^+\d]/', '', $person['phone']);
@@ -30,15 +25,9 @@ if (!empty($person['phone'])) {
?>
<article class="person-card">
<div class="person-card__media">
<?php if ($image): ?>
<img src="<?= e(asset($image)) ?>"
alt="<?= e($person['name']) ?>"
<img src="<?= e(asset($src)) ?>"
alt="<?= $image ? e($person['name']) : '' ?>"
width="480" height="600" loading="lazy" decoding="async">
<?php else: ?>
<div class="person-card__initials" aria-hidden="true">
<span><?= e($initials) ?></span>
</div>
<?php endif; ?>
</div>
<div class="person-card__body">
<h3 class="person-card__department"><?= e($person['department']) ?></h3>