feat: image compress before upload
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user