No description
Photos were being served exactly as uploaded, at whatever resolution and quality the source file had - a multi-megabyte camera/phone photo shown in a small tile still cost the visitor its full download weight. Uploads::compressImage() (new) downscales an image to a 1920px long edge if it's larger, and re-encodes it (JPEG quality 82, WEBP quality 82, PNG best compression) in place - same path, same format, just a lighter file. UploadController::store() now runs every new upload through it automatically, so this fixes itself going forward with no admin action needed. For images already sitting in uploads/ from before this change, SettingsController::compressUploads() (new endpoint, Einstellungen -> Datenbank -> "Bilder optimieren") re-processes every existing file in place and reports how much space was reclaimed - covers exactly the photos causing today's slow loads. Uses GD (near-universally available on shared hosting, unlike Imagick) and does nothing instead of erroring if the extension or an unrecognized file type is encountered, so an environment without GD just keeps today's behavior rather than breaking uploads. Verified locally (GD wasn't enabled in this XAMPP install, enabled it to test - same php.ini already had zip enabled for the git-updater feature): a synthetic 3000x2000 JPEG dropped from ~1.86MB to ~279KB and a test PNG's alpha transparency survived resizing intact. Did not run the bulk compressor against this repo's own uploads/ folder, since ~200 of those files are git-tracked seed/demo images, not disposable local test data. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| hifi | ||
| hifi-src | ||
| .gitignore | ||
| DEPLOY.md | ||