structure refacto & file documentation
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s

This commit is contained in:
Shinuwa 2026-07-25 17:51:53 +02:00
parent d7871736c8
commit 895fec2b40
84 changed files with 2629 additions and 2313 deletions

View file

@ -0,0 +1,11 @@
// Rôle : compresse les images utilisateur avant stockage IndexedDB.
export async function compressImage(file) {
const bitmap = await createImageBitmap(file);
const maxSide = 1400;
const ratio = Math.min(1, maxSide / Math.max(bitmap.width, bitmap.height));
const canvas = document.createElement("canvas");
canvas.width = Math.round(bitmap.width * ratio);
canvas.height = Math.round(bitmap.height * ratio);
canvas.getContext("2d").drawImage(bitmap, 0, 0, canvas.width, canvas.height);
return canvas.toDataURL("image/jpeg", 0.78);
}