From cdb43e1ff2f1e5b278e593c143ca5469db90d9a1 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Wed, 3 Sep 2025 10:54:54 +0000 Subject: [PATCH] Improve social image generation with a new modern design and gradient Update the /api/social-image endpoint to use a new SVG design with improved gradients, decorative elements, and text styling for social media previews. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/HCAS0JG --- server/routes.ts | 54 ++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/server/routes.ts b/server/routes.ts index 71a489d..8ae8bb9 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -701,59 +701,69 @@ export async function registerRoutes(app: Express): Promise { // Optimized social image endpoint app.get('/api/social-image', async (req, res) => { try { - // Generate a modern social image with Sharp + console.log('📸 Generating social image...'); + + // Generate a large, high-quality social image with Sharp const width = 1200; const height = 630; - // Create a gradient background with text overlay + // Create a more prominent social media image const svg = ` - - + + + - + + + + - - - - - + + + + + - - - + + + - - go4.video - Professional Video Streaming Platform - FOLX STADL • Geschichte des Liedes • Premium Content + + go4.video + Professional Video Streaming + FOLX STADL • Geschichte des Liedes + Premium Video Content Platform `; - // Convert SVG to optimized PNG + // Convert SVG to high-quality PNG with better compression const buffer = await sharp(Buffer.from(svg)) .png({ - quality: 85, - compressionLevel: 8, + quality: 90, + compressionLevel: 6, progressive: true }) .toBuffer(); + console.log(`📸 Social image generated: ${buffer.length} bytes`); + res.setHeader('Content-Type', 'image/png'); - res.setHeader('Cache-Control', 'public, max-age=3600'); // Cache 1 hour for easier updates + res.setHeader('Cache-Control', 'public, max-age=1800'); // Cache 30 minutes res.setHeader('Content-Length', buffer.length); + res.setHeader('Access-Control-Allow-Origin', '*'); // Allow cross-origin for social media res.send(buffer); } catch (error) { - console.error('Error generating optimized social image:', error); + console.error('❌ Error generating social image:', error); res.status(500).send('Error generating social image'); } });