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'); } });