[object Object]

← back to Designer Wallcoverings

Hollywood email: 3 approved scale-corrected room-setting heroes + Shopify Files uploader

544000407bcfb968f7977c365d47616b01238a6f · 2026-06-30 17:50:55 -0700 · Steve

Files touched

Diff

commit 544000407bcfb968f7977c365d47616b01238a6f
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jun 30 17:50:55 2026 -0700

    Hollywood email: 3 approved scale-corrected room-setting heroes + Shopify Files uploader
---
 mailers/hollywood-room-croco.jpg      | Bin 0 -> 326040 bytes
 mailers/hollywood-room-fauxlinen.jpg  | Bin 0 -> 226391 bytes
 mailers/hollywood-room-grasscloth.jpg | Bin 0 -> 219200 bytes
 mailers/upload-hollywood-rooms.js     |  48 ++++++++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+)

diff --git a/mailers/hollywood-room-croco.jpg b/mailers/hollywood-room-croco.jpg
new file mode 100644
index 00000000..cbadb97c
Binary files /dev/null and b/mailers/hollywood-room-croco.jpg differ
diff --git a/mailers/hollywood-room-fauxlinen.jpg b/mailers/hollywood-room-fauxlinen.jpg
new file mode 100644
index 00000000..397ce9cd
Binary files /dev/null and b/mailers/hollywood-room-fauxlinen.jpg differ
diff --git a/mailers/hollywood-room-grasscloth.jpg b/mailers/hollywood-room-grasscloth.jpg
new file mode 100644
index 00000000..c693a734
Binary files /dev/null and b/mailers/hollywood-room-grasscloth.jpg differ
diff --git a/mailers/upload-hollywood-rooms.js b/mailers/upload-hollywood-rooms.js
new file mode 100644
index 00000000..915d7f96
--- /dev/null
+++ b/mailers/upload-hollywood-rooms.js
@@ -0,0 +1,48 @@
+// Upload the 3 approved Hollywood room-setting heroes to Shopify Files → prints their CDN URLs.
+// Run:  node upload-hollywood-rooms.js
+const fs = require('fs');
+const env = Object.fromEntries(
+  fs.readFileSync('/Users/stevestudio2/Projects/secrets-manager/.env', 'utf8')
+    .split('\n').filter(l => l.includes('=')).map(l => { const i = l.indexOf('='); return [l.slice(0, i).trim(), l.slice(i + 1).trim()]; })
+);
+const STORE = env.SHOPIFY_STORE_DOMAIN || 'designer-laboratory-sandbox.myshopify.com';
+const TOKEN = env.SHOPIFY_ADMIN_TOKEN;
+const API = `https://${STORE}/admin/api/2024-10/graphql.json`;
+const FILES = ['hollywood-room-croco.jpg', 'hollywood-room-grasscloth.jpg', 'hollywood-room-fauxlinen.jpg'];
+const gql = (q, v) => fetch(API, { method: 'POST', headers: { 'X-Shopify-Access-Token': TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({ query: q, variables: v }) }).then(r => r.json());
+
+async function uploadOne(file) {
+  const path = __dirname + '/' + file;
+  const bytes = fs.statSync(path).size;
+  const s = await gql(`mutation($i:[StagedUploadInput!]!){stagedUploadsCreate(input:$i){stagedTargets{url resourceUrl parameters{name value}} userErrors{message}}}`,
+    { i: [{ resource: 'FILE', filename: file, mimeType: 'image/jpeg', httpMethod: 'POST', fileSize: String(bytes) }] });
+  const t = s.data?.stagedUploadsCreate?.stagedTargets?.[0];
+  if (!t) throw new Error('staged: ' + JSON.stringify(s));
+  const fd = new FormData();
+  for (const p of t.parameters) fd.append(p.name, p.value);
+  fd.append('file', new Blob([fs.readFileSync(path)], { type: 'image/jpeg' }), file);
+  const up = await fetch(t.url, { method: 'POST', body: fd });
+  if (up.status >= 400) throw new Error('POST ' + up.status);
+  const c = await gql(`mutation($f:[FileCreateInput!]!){fileCreate(files:$f){files{... on MediaImage{id}} userErrors{message}}}`,
+    { f: [{ originalSource: t.resourceUrl, contentType: 'IMAGE', alt: file.replace(/\.jpg$/, '').replace(/-/g, ' ') }] });
+  const id = c.data?.fileCreate?.files?.[0]?.id;
+  if (!id) throw new Error('fileCreate: ' + JSON.stringify(c));
+  for (let i = 0; i < 16; i++) {
+    await new Promise(r => setTimeout(r, 2500));
+    const q = await gql(`query($id:ID!){node(id:$id){... on MediaImage{fileStatus image{url}}}}`, { id });
+    const u = q.data?.node?.image?.url;
+    if (u) return u;
+  }
+  return '(still processing, id ' + id + ')';
+}
+
+(async () => {
+  const out = {};
+  for (const f of FILES) {
+    process.stdout.write('uploading ' + f + ' … ');
+    try { out[f] = await uploadOne(f); console.log('ok'); }
+    catch (e) { out[f] = 'ERROR ' + e.message; console.log('FAIL', e.message); }
+  }
+  console.log('\n=== READY — paste this whole block back to Claude ===');
+  for (const f of FILES) console.log(f + '  ->  ' + out[f]);
+})();

← 77e1c281 auto-save: 2026-06-30T17:42:20 (5 files) — pending-approval/  ·  back to Designer Wallcoverings  ·  chore: v1.1.0 (session close — PJ 10/day DWPJ draft drip) 6fa4f036 →