feat: image compress before upload
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
DrawerTitle,
|
||||
} from "@/components/ui/drawer";
|
||||
import { posts, SocialError, type Post } from "@/lib/social";
|
||||
import { compressImage } from "@/lib/compress-image";
|
||||
|
||||
type Busy = "upload" | "remove" | null;
|
||||
|
||||
@@ -69,7 +70,8 @@ export function UpdateBackgroundModal({
|
||||
if (!file) return;
|
||||
setBusy("upload");
|
||||
try {
|
||||
const url = await posts.uploadImage(file);
|
||||
const compressed = await compressImage(file);
|
||||
const url = await posts.uploadImage(compressed);
|
||||
const updated = await posts.replaceImages(post.id, [url]);
|
||||
toast.success("Background updated");
|
||||
onUpdated?.(updated);
|
||||
|
||||
Reference in New Issue
Block a user