feat: image compress before upload

This commit is contained in:
gosangam
2026-05-31 09:56:53 +05:30
parent 5506afa758
commit 8bd82a0e8a
10 changed files with 673 additions and 60 deletions
+3 -1
View File
@@ -47,6 +47,7 @@ import {
type Collection,
type Post,
} from "@/lib/social";
import { compressImage } from "@/lib/compress-image";
type SavedShape = {
collection: Collection;
@@ -142,7 +143,8 @@ export function EditCollectionDrawer({
if (!f) return;
setUploadingCover(true);
try {
const url = await collections.uploadCover(f);
const compressed = await compressImage(f);
const url = await collections.uploadCover(compressed);
setCoverURL(url);
} catch (err) {
toast.error(