From a9ae0d310ac0b220e7cdeac6da371e9379faa9c1 Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:36:35 +0200 Subject: [PATCH] Show whether image compression is actually active on this server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was no way to tell whether the gd extension the compression feature depends on was actually enabled - the button always looked the same and silently did nothing per file if gd was missing. Adds a status badge (Aktiv/Nicht verfügbar) next to "Bilder optimieren", backed by a new GET /settings/compress-status endpoint, and disables the button with an explanatory note when gd isn't available: shared hosts like All-Inkl don't offer a way to toggle individual PHP extensions (unlike a VPS), so the note points at hoster support / PHP version selection rather than a nonexistent self-service toggle. Co-Authored-By: Claude Sonnet 5 --- .../pages/admin/settings/DatabaseSettings.jsx | 28 +++++++++- hifi/api/public/index.php | 1 + .../src/Controllers/SettingsController.php | 11 ++++ .../{index-Cx42TygC.js => index-BbPnpRj7.js} | 52 +++++++++---------- hifi/index.html | 2 +- 5 files changed, 65 insertions(+), 29 deletions(-) rename hifi/assets/{index-Cx42TygC.js => index-BbPnpRj7.js} (92%) diff --git a/hifi-src/src/pages/admin/settings/DatabaseSettings.jsx b/hifi-src/src/pages/admin/settings/DatabaseSettings.jsx index 6b74cf2..ae2a180 100644 --- a/hifi-src/src/pages/admin/settings/DatabaseSettings.jsx +++ b/hifi-src/src/pages/admin/settings/DatabaseSettings.jsx @@ -18,6 +18,7 @@ export default function DatabaseSettings() { const [compressBusy, setCompressBusy] = useState(false); const [compressResult, setCompressResult] = useState(null); const [compressError, setCompressError] = useState(''); + const [gdAvailable, setGdAvailable] = useState(null); const loadDbConfig = () => { setLoading(true); @@ -38,6 +39,7 @@ export default function DatabaseSettings() { useEffect(() => { loadDbConfig(); checkSchema(); + api.get('/settings/compress-status').then((res) => setGdAvailable(res.gd_available)).catch(() => setGdAvailable(false)); }, []); const handleMigrateSchema = async () => { @@ -233,15 +235,37 @@ export default function DatabaseSettings() {
-

Bilder optimieren

+
+

Bilder optimieren

+ {gdAvailable !== null && ( + + {gdAvailable ? 'Aktiv' : 'Nicht verfügbar'} + + )} +

Neu hochgeladene Bilder werden seit Kurzem automatisch verkleinert und komprimiert. Dieser Button holt das für alle bereits vorhandenen Bilder nach – nützlich, wenn die Seite durch zu hoch aufgelöste Fotos spürbar langsam lädt.

+ {gdAvailable === false && ( +

+ Diese Funktion braucht die PHP-Erweiterung "gd", die auf diesem Server aktuell nicht + aktiv ist. Bei den meisten Hostern (auch All-Inkl) ist sie standardmäßig Teil jeder + PHP-Version und lässt sich nicht einzeln zu- oder abschalten – bitte beim Hoster-Support + nachfragen bzw. prüfen, ob in den Hosting-Einstellungen eine andere PHP-Version + ausgewählt werden muss. +

+ )}