[object Object]

← back to Goldleafwallpaper

ig-poster: crop the Phillipe Romano header banner off each image before posting (Shopify CDN crop=bottom)

49ec03e9a12f21818e6454e1497b95d5106af4bc · 2026-08-10 12:51:35 -0700 · Steve Abrams

Files touched

Diff

commit 49ec03e9a12f21818e6454e1497b95d5106af4bc
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 10 12:51:35 2026 -0700

    ig-poster: crop the Phillipe Romano header banner off each image before posting (Shopify CDN crop=bottom)
---
 scripts/ig-poster/post-next.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/scripts/ig-poster/post-next.js b/scripts/ig-poster/post-next.js
index 93acccd..1c427e5 100644
--- a/scripts/ig-poster/post-next.js
+++ b/scripts/ig-poster/post-next.js
@@ -35,6 +35,16 @@ const IG_USER = process.env.GOLDLEAF_IG_USER_ID || '';
 const FORCE_DRY = process.env.DRY_RUN === '1';
 const LIVE = Boolean(TOKEN && IG_USER) && !FORCE_DRY;
 
+// The RML product photos carry a branded "PHILLIPE ROMANO — WALLPAPER · FABRICS
+// · LOS ANGELES" header banner across the top ~20% (plus an S-#### tag). Steve
+// wants the collection posted with NO headers — it looks ugly on the feed. The
+// Shopify CDN can crop it off via URL params (keep the bottom-anchored 5:4
+// region), so no local processing or image hosting is needed.
+function cropHeaderUrl(url) {
+  const base = String(url).split('?')[0];
+  return `${base}?width=500&height=400&crop=bottom`;
+}
+
 function loadProducts() {
   const arr = JSON.parse(fs.readFileSync(PRODUCTS, 'utf8'));
   // Only post SKUs that have a usable public image and a dw_sku.
@@ -109,20 +119,21 @@ async function publish(imageUrl, caption) {
   const sku = state.order[state.idx];
   const product = byId.get(sku);
   const caption = buildCaption(product, state.idx);
+  const postImageUrl = cropHeaderUrl(product.image_url); // header cropped off
 
   const base = {
     ts: nowISO(), mode: LIVE ? 'LIVE' : 'DRY', dw_sku: sku,
-    mfr_sku: product.mfr_sku || '', image_url: product.image_url,
+    mfr_sku: product.mfr_sku || '', image_url: postImageUrl,
     cursor: state.idx, cycles: state.cycles || 0, caption,
   };
 
   console.log(`\n[goldleaf-ig] ${base.mode}  ${sku}  (cursor ${state.idx + 1}/${state.order.length}, cycle ${base.cycles})`);
-  console.log('image:', product.image_url);
+  console.log('image (header cropped):', postImageUrl);
   console.log('caption:\n' + caption + '\n');
 
   if (LIVE) {
     try {
-      const res = await publish(product.image_url, caption);
+      const res = await publish(postImageUrl, caption);
       appendLog({ ...base, result: 'ok', ...res });
       // Advance the rotating cursor ONLY on a real successful post.
       state.idx += 1;

← 018206f ig-poster: loud CNCP alert on token/auth failure (no silent  ·  back to Goldleafwallpaper  ·  ig-poster: add resumable bulk reposter (repost-all.js) — hea b715c46 →