diff --git a/assets/css/style.css b/assets/css/style.css
index dc9204a..21c2897 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -173,7 +173,10 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
border: 1px solid rgba(255, 255, 255, 0.15);
}
-.hero .avatar { margin-bottom: 1rem; }
+.avatar-wrap { display: inline-flex; }
+
+.hero .avatar,
+.hero .avatar-wrap { margin-bottom: 1rem; }
.app-content {
flex: 1;
@@ -520,6 +523,12 @@ input:focus, select:focus, textarea:focus {
color: var(--gold);
}
+.profile-header {
+ display: flex;
+ align-items: center;
+ gap: 1.25rem;
+}
+
.profile-grid {
display: grid;
grid-template-columns: 1fr 1fr;
diff --git a/includes/functions.php b/includes/functions.php
index 0597d46..09a9d4a 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -135,17 +135,12 @@ function discord_logo(int $size = 24): string
// Profilbild: Discord-Avatar, falls verknuepft und gesetzt, sonst ein
// Platzhalter mit dem Anfangsbuchstaben des Anzeigenamens auf einem
// nutzerfest zugeordneten Hintergrund aus einer zur Lumina-Optik passenden Palette.
+// Der Platzhalter wird zusaetzlich immer mitgerendert (nur unsichtbar), damit
+// bei einem fehlschlagenden Discord-Bild (abgelaufener Hash, Netzwerk-/
+// Trackingblocker o.ae.) per onerror automatisch darauf zurueckgefallen wird,
+// statt ein kaputtes Bild-Icon anzuzeigen.
function avatar_html(array $user, int $size = 40): string
{
- if (!empty($user['discord_id']) && !empty($user['discord_avatar'])) {
- $ext = str_starts_with((string) $user['discord_avatar'], 'a_') ? 'gif' : 'png';
- $url = 'https://cdn.discordapp.com/avatars/' . rawurlencode((string) $user['discord_id'])
- . '/' . rawurlencode((string) $user['discord_avatar']) . '.' . $ext . '?size=' . ($size * 2);
-
- return '';
- }
-
static $palette = ['#4f6f52', '#6a4c93', '#1b6ca8', '#b5533c', '#8a6d3b', '#3f6c86', '#4a5568', '#a4443a'];
$name = trim((string) ($user['display_name'] ?? '')) !== '' ? $user['display_name'] : (string) ($user['username'] ?? '');
@@ -158,8 +153,26 @@ function avatar_html(array $user, int $size = 40): string
$color = $palette[crc32($seed) % count($palette)];
$fontSize = round($size * 0.42, 1);
- return '' . e($letter) . '';
+ $hasDiscordAvatar = !empty($user['discord_id']) && !empty($user['discord_avatar']);
+
+ $placeholderStyle = 'width:' . $size . 'px;height:' . $size . 'px;background:' . e($color) . ';font-size:' . $fontSize . 'px;'
+ . ($hasDiscordAvatar ? 'display:none;' : '');
+ $placeholder = '' . e($letter) . '';
+
+ if (!$hasDiscordAvatar) {
+ return $placeholder;
+ }
+
+ $ext = str_starts_with((string) $user['discord_avatar'], 'a_') ? 'gif' : 'png';
+ $url = 'https://cdn.discordapp.com/avatars/' . rawurlencode((string) $user['discord_id'])
+ . '/' . rawurlencode((string) $user['discord_avatar']) . '.' . $ext . '?size=' . ($size * 2);
+
+ return ''
+ . '
"
+ . $placeholder
+ . '';
}
// Ordnet die (teils deutschen) Klassennamen aus dem Raid-Bot den Icon-Dateien
diff --git a/profile.php b/profile.php
index b6383cd..f253a3e 100644
--- a/profile.php
+++ b/profile.php
@@ -41,8 +41,13 @@ $pageTitle = 'Mein Profil';
include __DIR__ . '/includes/header.php';
?>
Benutzername: = e($user['username']) ?>
+Benutzername: = e($user['username']) ?>
+