mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-18 04:36:32 +02:00
fix: télécharger l'image avant traitement Sharp pour les stories avec texte
This commit is contained in:
1 parent
4f8bab176a
commit
b38f082d6e
2 files changed
+18
-13
No files matched your search
@@ -125,8 +125,15 @@ export class ImageProcessor {
|
||||
// Remove hashtags from text while keeping emojis
|
||||
const cleanText = removeHashtags(text);
|
||||
|
||||
// Download image from URL first (Sharp can't read URLs directly)
|
||||
const imageResponse = await fetch(imageUrl);
|
||||
if (!imageResponse.ok) {
|
||||
throw new Error(`Failed to fetch image from URL: ${imageUrl}`);
|
||||
}
|
||||
const imageBuffer = Buffer.from(await imageResponse.arrayBuffer());
|
||||
|
||||
// Pre-process image with sharp to apply rotation
|
||||
const rotationBuffer = await sharp(imageUrl)
|
||||
const rotationBuffer = await sharp(imageBuffer)
|
||||
.rotate() // Apply EXIF rotation
|
||||
.toBuffer();
|
||||
|
||||
|
||||
Reference in new issue
Block a user