diff --git a/server/index.ts b/server/index.ts index ffcb323..3c35319 100644 --- a/server/index.ts +++ b/server/index.ts @@ -101,6 +101,7 @@ app.use((req, res, next) => { } console.log(`✅ Video found for social bot: ${video.title}`); + console.log(`📷 Original thumbnail: ${video.thumbnailUrl}`); // Preberemo osnovni HTML template const clientTemplate = path.resolve(import.meta.dirname, "..", "client", "index.html"); @@ -114,7 +115,16 @@ app.use((req, res, next) => { // Use short ID for sharing URLs const shortId = video.id.replace(/-/g, '').substring(0, 8); const videoUrl = `${baseUrl}/video/${shortId}`; - const thumbnailUrl = video.thumbnailUrl || `${baseUrl}/api/video-thumbnail/${video.id}`; + // Optimize thumbnail for social media sharing - larger size and JPEG format + let thumbnailUrl = video.thumbnailUrl; + if (thumbnailUrl) { + // Replace small WebP with larger JPEG for better social media compatibility + thumbnailUrl = thumbnailUrl + .replace('width=400&height=225', 'width=1200&height=630') + .replace('format=webp', 'format=jpg'); + } else { + thumbnailUrl = `${baseUrl}/api/video-thumbnail/${video.id}`; + } // Zamenjamo osnovne meta oznake template = template.replace(