Repository navigation
feat(checkin): optimize and compress check-in images before S3 storage - #77
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Integra la optimización de imágenes en el pipeline de check-in del servidor mediante
sharp, asegurando dimensiones uniformes, auto-orientación y eficiencia de almacenamiento en Garage S3 con una arquitectura de fallback tolerante a fallos (fail-open).Motivación y Contexto
El objetivo principal de esta implementación es cuidar el uso del almacenamiento (storage), dado que la capacidad de almacenamiento de objetos (S3) es limitada.$12\text{ a }48\text{ MP}+$ ), generando archivos de entre $3\text{ MB}$ y $15\text{ MB}+$ cada una. Para los fines de la plataforma Rayuela (validación comunitaria y científica de observaciones), no es necesaria tanta calidad ni resoluciones extremas de impresión.
Las cámaras modernas capturan fotografías con resoluciones masivas (
Por ello, unificamos todas las imágenes en un tamaño estándar máximo (bounding box de 1600px) y formato JPEG optimizado (calidad 80), logrando reducir más del 90% del espacio ocupado en storage.
Cambios Clave
optimizeImage()enCheckinServiceutilizandosharppara normalizar las imágenes subidas (rotate(),resizemax 1600px proporcional sin ampliación, JPEG calidad 80) antes de persistirlas en S3.sharp@0.32.6(compatible con el entorno Node.js 16/18 de CI y Node 20+ en ejecución) y se habilitóesModuleInterop: trueentsconfig.json.docs/mobile/image-compression.mdcon el flujo completo de arquitectura y se vinculó en_sidebar.mdymobile/workflows.md.Resultados Empíricos (Prueba End-to-End)
Verificado contra el bucket
rayuela-checkinsen Garage S3:Verificación
npm run lint: Limpionpm run build: Compilación exitosanpm run test: 57/57 suites pasadas (477/477 tests, incluyendo tests unitarios paraoptimizeImagey fallback fail-open)