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
This commit is contained in:
sebastjanartic 2025-09-03 13:03:31 +00:00
parent 529d81649a
commit 89f9f702c6

View File

@ -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(