Person-Card: geschlechtsneutraler Initialen-Avatar als Fallback (statt männlichem Foto-Platzhalter), platzhalter.jpg entfernt

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

View File

@@ -5,11 +5,16 @@ declare(strict_types=1);
/**
* Visitenkarte für eine Person. Props:
* $person array{department, name, phone?, email?, image?}
* Ohne image greift der Vereins-Platzhalter (Silhouette im TSV-Trikot).
* Ohne image rendert die Karte einen geschlechtsneutralen Initialen-Avatar
* (Coolvetica-Initialen + Logo-Wasserzeichen) — keinen Foto-Platzhalter.
* Kontakt-Link: phone → tel:, sonst email → mailto:.
*/
$image = $person['image'] ?? null;
$src = $image ?: 'img/persons/platzhalter.jpg';
$initials = implode('', array_map(
static fn (string $word): string => mb_substr($word, 0, 1),
array_slice(preg_split('/\s+/', trim($person['name'])) ?: [], 0, 2)
));
if (!empty($person['phone'])) {
$contactHref = 'tel:' . preg_replace('/[^+\d]/', '', $person['phone']);
@@ -25,9 +30,15 @@ if (!empty($person['phone'])) {
?>
<article class="person-card">
<div class="person-card__media">
<img src="<?= e(asset($src)) ?>"
alt="<?= $image ? e($person['name']) : '' ?>"
<?php if ($image): ?>
<img src="<?= e(asset($image)) ?>"
alt="<?= 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>