feat: Implement Remotion video generation with client-side image selection and server-side rendering.

This commit is contained in:
Michael committed 2026-03-24 12:48:53 +01:00
1 parent e41c43c1da
commit 526e608077
4 files changed
+325 -21

No files matched your search

+17 -5
View File
@@ -25,14 +25,26 @@ const upload = multer({ storage });
remotionRouter.post("/render", upload.array("images", 4), async (req, res) => {
try {
const files = req.files as Express.Multer.File[];
if (!files || files.length === 0) {
return res.status(400).json({ error: "Aucune image fournie" });
let imageUrls: string[] = [];
const existing = req.body.existingImageUrls;
if (existing) {
if (Array.isArray(existing)) {
imageUrls.push(...existing);
} else {
imageUrls.push(existing);
}
}
const host = req.protocol + "://" + req.get("host");
const imageUrls = files.map(file => {
return `${host}/uploads/temp/${path.basename(file.path)}`;
});
if (files && files.length > 0) {
const uploadedUrls = files.map(file => `${host}/uploads/temp/${path.basename(file.path)}`);
imageUrls.push(...uploadedUrls);
}
if (imageUrls.length === 0) {
return res.status(400).json({ error: "Aucune image fournie" });
}
console.log("Bundling Remotion project...");
const bundleLocation = await bundle({