mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-23 06:58:12 +02:00
feat: Implement Remotion video generation with client-side image selection and server-side rendering.
This commit is contained in:
1 parent
e41c43c1da
commit
526e608077
4 files changed
+325
-21
No files matched your search
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user