From f3497c8b96a4300a9a4e5f2cb66898bc849483c7 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 2 Oct 2025 11:06:19 +0000 Subject: [PATCH 1/3] Transitioned from Plan to Build mode Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/4KAFpKS From 4370829b7e3f7aa9804b3983255b8acd17f8d45b Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 2 Oct 2025 11:08:54 +0000 Subject: [PATCH 2/3] Add optimized image versions for social media posts Update Cloudinary service to generate specific image transformations (Facebook Feed, Instagram Feed, Instagram Story) during upload using eager transformations. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/g8ompNP --- .replit | 4 ++++ server/services/cloudinary.ts | 33 +++++++++++++++------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.replit b/.replit index ffeb98a..c38aaa8 100644 --- a/.replit +++ b/.replit @@ -18,6 +18,10 @@ externalPort = 80 localPort = 5555 externalPort = 3002 +[[ports]] +localPort = 39327 +externalPort = 3003 + [[ports]] localPort = 40537 externalPort = 3000 diff --git a/server/services/cloudinary.ts b/server/services/cloudinary.ts index d7dc0e7..5668ff4 100644 --- a/server/services/cloudinary.ts +++ b/server/services/cloudinary.ts @@ -31,13 +31,22 @@ class CloudinaryService { const isVideo = mimeType.startsWith('video/'); - // Upload to Cloudinary + // Define eager transformations for images (generated during upload) + const eagerTransformations = !isVideo ? [ + { width: 1200, height: 630, crop: 'pad', background: 'auto' }, // Facebook Feed + { width: 1080, height: 1080, crop: 'pad', background: 'auto' }, // Instagram Feed + { width: 1080, height: 1920, crop: 'pad', background: 'auto' } // Instagram Story + ] : undefined; + + // Upload to Cloudinary with eager transformations const uploadResult = await new Promise((resolve, reject) => { const uploadStream = cloudinary.uploader.upload_stream( { folder: 'social-flow', public_id: `${Date.now()}-${fileName.replace(/\.[^/.]+$/, '')}`, resource_type: isVideo ? 'video' : 'image', + eager: eagerTransformations, + eager_async: false, // Generate transformations immediately }, (error, result) => { if (error) reject(error); @@ -51,27 +60,15 @@ class CloudinaryService { const publicId = uploadResult.public_id; const originalUrl = uploadResult.secure_url; - // Generate transformation URLs only for images + // Extract eager transformation URLs (generated by Cloudinary during upload) let facebookFeedUrl = null; let instagramFeedUrl = null; let instagramStoryUrl = null; - if (!isVideo) { - facebookFeedUrl = cloudinary.url(publicId, { - transformation: [ - { width: 1200, height: 630, crop: 'pad', background: 'black' } - ] - }); - instagramFeedUrl = cloudinary.url(publicId, { - transformation: [ - { width: 1080, height: 1080, crop: 'pad', background: 'black' } - ] - }); - instagramStoryUrl = cloudinary.url(publicId, { - transformation: [ - { width: 1080, height: 1920, crop: 'pad', background: 'black' } - ] - }); + if (!isVideo && uploadResult.eager && uploadResult.eager.length === 3) { + facebookFeedUrl = uploadResult.eager[0].secure_url; // Facebook Feed (1200x630) + instagramFeedUrl = uploadResult.eager[1].secure_url; // Instagram Feed (1080x1080) + instagramStoryUrl = uploadResult.eager[2].secure_url; // Instagram Story (1080x1920) } return { From 981af4f5085e4cbcd3ae71455dda98c5fd67cfee Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 2 Oct 2025 11:09:13 +0000 Subject: [PATCH 3/3] Improve platform reliability and prevent unexpected application crashes Fix potential runtime errors and enhance overall application stability. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/g8ompNP