From 89f9f702c6d3dea54b4ce46f7df32a1493a2bae6 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Wed, 3 Sep 2025 13:03:31 +0000 Subject: [PATCH] Improve video thumbnail sharing for social media platforms Optimize video thumbnail URL for social media sharing by increasing resolution and changing format from WebP to JPEG. 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/3dnI7Tc --- server/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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(