diff --git a/client/index.html b/client/index.html
index 8a9f69b..5a5b642 100644
--- a/client/index.html
+++ b/client/index.html
@@ -11,8 +11,9 @@
-
-
+
+
+
@@ -22,7 +23,7 @@
-
+
diff --git a/server/routes.ts b/server/routes.ts
index fc17268..2d1b091 100644
--- a/server/routes.ts
+++ b/server/routes.ts
@@ -698,6 +698,42 @@ export async function registerRoutes(app: Express): Promise {
}
});
+ // Optimized social image endpoint
+ app.get('/api/social-image', async (req, res) => {
+ try {
+ const fs = await import('fs');
+ const path = await import('path');
+
+ // Read the original social share image
+ const imagePath = path.join(process.cwd(), 'client/public/go4-video-social-share.png');
+
+ if (!fs.existsSync(imagePath)) {
+ return res.status(404).send('Social image not found');
+ }
+
+ const originalImage = fs.readFileSync(imagePath);
+
+ // Optimize with Sharp for WhatsApp/social media (under 300KB)
+ const optimizedBuffer = await sharp(originalImage)
+ .resize(1200, 630, { fit: 'cover' })
+ .png({
+ quality: 80,
+ compressionLevel: 9,
+ progressive: true
+ })
+ .toBuffer();
+
+ res.setHeader('Content-Type', 'image/png');
+ res.setHeader('Cache-Control', 'public, max-age=86400'); // Cache for 24 hours
+ res.setHeader('Content-Length', optimizedBuffer.length);
+ res.send(optimizedBuffer);
+
+ } catch (error) {
+ console.error('Error generating optimized social image:', error);
+ res.status(500).send('Error generating social image');
+ }
+ });
+
// Favicon generation endpoint
app.get('/api/favicon', async (req, res) => {
try {