feat: image upload optimization with sharp, thumbnails, and structured error codes (#304)

- Add sharp for server-side image processing (WebP conversion + thumbnails)
- New shared backend utility for image upload, optimization, and cleanup
- Return structured error codes from upload endpoints (IMAGE_TOO_LARGE, INVALID_TYPE, etc.)
- Frontend error code mapping with i18n support (EN + DE)
- MedicationAvatar tries thumbnail first, falls back to full image
- Error display in MedicationsPage, MobileEditModal, and Auth avatar upload

Closes #302
This commit is contained in:
Daniel Volz
2026-02-24 23:52:59 +01:00
committed by GitHub
parent 7a32b2045e
commit 96b2a0c96f
15 changed files with 916 additions and 93 deletions
+7
View File
@@ -183,6 +183,13 @@
"notes": "Notizen",
"medicationImage": "Medikamentenbild",
"removeImage": "Bild entfernen",
"imageUploadErrors": {
"tooLarge": "Das Bild ist zu groß. Die maximale Upload-Größe beträgt 10 MB.",
"invalidType": "Ungültiger Dateityp. Erlaubte Formate: JPEG, PNG, WebP, GIF.",
"invalidImage": "Ungültige oder nicht unterstützte Bilddatei.",
"noFile": "Es wurde keine Datei zum Hochladen ausgewählt.",
"generic": "Bild-Upload fehlgeschlagen. Bitte versuche es erneut."
},
"placeholders": {
"commercial": "z.B. Ozempic",
"generic": "z.B. Semaglutid (optional)",
+7
View File
@@ -183,6 +183,13 @@
"notes": "Notes",
"medicationImage": "Medication Image",
"removeImage": "Remove Image",
"imageUploadErrors": {
"tooLarge": "Image is too large. Maximum upload size is 10 MB.",
"invalidType": "Invalid file type. Allowed formats: JPEG, PNG, WebP, GIF.",
"invalidImage": "Invalid or unsupported image file.",
"noFile": "No file was selected for upload.",
"generic": "Image upload failed. Please try again."
},
"placeholders": {
"commercial": "e.g. Ozempic",
"generic": "e.g. Semaglutide (optional)",