From f51c21c7162857b6b502e19390d84a068aec5bba Mon Sep 17 00:00:00 2001 From: Folx Ops Date: Sat, 27 Jun 2026 08:51:28 +0000 Subject: [PATCH] og:image: Cloudinary g_faces 1200x630 (FB ne reze glav) --- server/static.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/static.ts b/server/static.ts index 0f02bbd..5adabda 100644 --- a/server/static.ts +++ b/server/static.ts @@ -10,6 +10,15 @@ function escapeHtml(str: string): string { function ogImageUrl(coverImage: string, baseUrl: string): string { if (!coverImage) return ""; let imgPath = coverImage; + // Cloudinary: vsili FB razmerje 1200x630 z g_faces (da FB ne reze glav) + if (imgPath.includes("res.cloudinary.com")) { + imgPath = imgPath.replace(/([,&/?])h_\d+/i, "$1h_630").replace(/([,&/?])w_\d+/i, "$1w_1200"); + // ce ni g_faces, ga dodaj + if (!/g_faces/.test(imgPath)) { + imgPath = imgPath.replace(/\/(image\/(upload|fetch))\//, "/$1/g_faces,"); + } + return imgPath; + } if (imgPath.endsWith(".webp")) { imgPath = imgPath.replace(/\.webp$/, ".jpg"); } @@ -102,8 +111,8 @@ export function serveStatic(app: Express) { ``, ``, ``, - ``, - ``, + ``, + ``, ``, ``, ``,