From 68cc9f4d1f205e0581a5bf20ed6fdf5fa23bf519 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Thu, 25 Apr 2024 11:37:15 -0600 Subject: [PATCH] make transistor images work --- app/utils/transistor.server.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/utils/transistor.server.ts b/app/utils/transistor.server.ts index 278ba49b8..c00bf93a1 100644 --- a/app/utils/transistor.server.ts +++ b/app/utils/transistor.server.ts @@ -183,6 +183,12 @@ async function createEpisode({ const nameYPosition = -textLines + 5.2 const imageUrl = `https://res.cloudinary.com/kentcdodds-com/image/upload/$th_3000,$tw_3000,$gw_$tw_div_12,$gh_$th_div_12/w_$tw,h_$th,l_kentcdodds.com:social-background/co_white,c_fit,g_north_west,w_$gw_mul_6,h_$gh_mul_2.6,x_$gw_mul_0.8,y_$gh_mul_0.8,l_text:kentcdodds.com:Matter-Medium.woff2_180:${encodedTitle}/c_crop${radius},g_north_west,h_$gh_mul_5.5,w_$gh_mul_5.5,x_$gw_mul_0.8,y_$gh_mul_${avatarYPosition},l_fetch:${encodedAvatar}/co_rgb:a9adc1,c_fit,g_south_west,w_$gw_mul_8,h_$gh_mul_4,x_$gw_mul_0.8,y_$gh_mul_0.8,l_text:kentcdodds.com:Matter-Regular.woff2_120:${encodedUrl}/co_rgb:a9adc1,c_fit,g_south_west,w_$gw_mul_8,h_$gh_mul_4,x_$gw_mul_0.8,y_$gh_mul_${nameYPosition},l_text:kentcdodds.com:Matter-Regular.woff2_140:${encodedName}/c_fit,g_east,w_$gw_mul_11,h_$gh_mul_11,x_$gw,l_kentcdodds.com:illustrations:mic/c_fill,w_$tw,h_$th/kentcdodds.com/social-background.png` + // warm up the image on cloudinary + await fetch(imageUrl, { + method: 'HEAD', + signal: AbortSignal.timeout(2000), + }).catch(() => {}) + returnValue.episodeUrl = `${domainUrl}${episodePath}` returnValue.imageUrl = imageUrl const updateData: TransistorUpdateEpisodeData = {