From 26695290532c34c0857d80c8ccc2a64984aa3e63 Mon Sep 17 00:00:00 2001 From: Barry Frost Date: Sun, 24 Nov 2024 17:47:17 +0000 Subject: [PATCH] Fetch smaller images from Cloudinary --- src/events/process-post/syndicate/bluesky.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/events/process-post/syndicate/bluesky.js b/src/events/process-post/syndicate/bluesky.js index c5e96b3..38cefb2 100644 --- a/src/events/process-post/syndicate/bluesky.js +++ b/src/events/process-post/syndicate/bluesky.js @@ -22,9 +22,13 @@ async function syndicate (post) { const photos = post.properties.photo.slice(0, 4) // max 4 for (const photo of photos) { const url = (typeof photo === 'string') ? photo : photo.value + const starts = 'https://res.cloudinary.com/barryf/image/upload/' + if (url.startsWith(starts)) { + url.replace(starts, `${starts}h_768/`) + } const alt = (typeof photo === 'string') ? '' : photo.alt const response = await fetch(url) - // if (!response.ok) continue + if (!response.ok) continue const arrayBuffer = await response.arrayBuffer() const buffer = Buffer.from(arrayBuffer) const { data } = await agent.uploadBlob( @@ -43,7 +47,6 @@ async function syndicate (post) { images } } - console.log('richPost', richPost) const response = await agent.post(richPost) if (!response.ok) return