diff --git a/attached_assets/Gemini_Generated_Image_eb3aveb3aveb3ave_1756906458637.png b/attached_assets/Gemini_Generated_Image_eb3aveb3aveb3ave_1756906458637.png new file mode 100644 index 0000000..b1f4c51 Binary files /dev/null and b/attached_assets/Gemini_Generated_Image_eb3aveb3aveb3ave_1756906458637.png differ diff --git a/client/public/social-share-image.png b/client/public/social-share-image.png new file mode 100644 index 0000000..b1f4c51 Binary files /dev/null and b/client/public/social-share-image.png differ diff --git a/server/routes.ts b/server/routes.ts index 0f9fb5c..e004aa2 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -732,73 +732,59 @@ export async function registerRoutes(app: Express): Promise { } }); - // Optimized social image endpoint + // Custom social image endpoint - serves your beautiful uploaded image app.get('/api/social-image', async (req, res) => { try { - console.log('📸 Generating social image...'); + console.log('📸 Serving custom social image...'); - // Generate a large, high-quality social image with Sharp - const width = 1200; - const height = 630; + const path = require('path'); + const fs = require('fs'); - // Create a more prominent social media image - const svg = ` - - - - - - - - - - - - - - - + const imagePath = path.join(__dirname, '..', 'client', 'public', 'social-share-image.png'); + + // Check if custom image exists + if (fs.existsSync(imagePath)) { + console.log('✅ Custom social image found, serving...'); + const imageBuffer = fs.readFileSync(imagePath); - - + res.setHeader('Content-Type', 'image/png'); + res.setHeader('Content-Length', imageBuffer.length); + res.setHeader('Cache-Control', 'public, max-age=3600'); // Cache for 1 hour + res.setHeader('Access-Control-Allow-Origin', '*'); // Allow cross-origin for social media + res.send(imageBuffer); + } else { + console.log('⚠️ Custom image not found, generating fallback...'); + // Fallback to generated image if custom not found + const width = 1200; + const height = 630; - - - - - - - - - - - - go4.video - Professional Video Streaming - FOLX STADL • Geschichte des Liedes - Premium Video Content Platform - `; + const svg = ` + + + + + + + + + go4.video + Video-Welt von Folx TV + `; - // Convert SVG to high-quality PNG with better compression - const buffer = await sharp(Buffer.from(svg)) - .png({ - 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=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); + const buffer = await sharp(Buffer.from(svg)) + .png({ quality: 95, compressionLevel: 6 }) + .toBuffer(); + + res.setHeader('Content-Type', 'image/png'); + res.setHeader('Content-Length', buffer.length); + res.setHeader('Cache-Control', 'public, max-age=3600'); + res.setHeader('Access-Control-Allow-Origin', '*'); + res.send(buffer); + } } catch (error) { - console.error('❌ Error generating social image:', error); - res.status(500).send('Error generating social image'); + console.error('❌ Error serving social image:', error); + res.status(500).send('Error serving social image'); } });