[object Object]

← back to CelebritySignatures

murals: fix selected mural not appearing (SVG thumbnails 400'd)

7884b61e2079c2e06d0296a23c698df14b33ede9 · 2026-08-06 08:19:27 -0700 · steve

thumbUrl built /thumb/.../200px-X.svg.png for SVG signatures, which Wikimedia
returns 400 for — so nearly every grid cell broke and the mural rendered as a
blank white box. Route SVGs through Special:FilePath?width=N (reliable PNG
rasterizer, same as the app's sigImg). Verified all 6 murals now load 100% of
images (was 0%). Also fixed drag-clamp to use the user's current mural size
(murDims) instead of the fixed catalog size, so a resized mural stays on the wall.

Files touched

Diff

commit 7884b61e2079c2e06d0296a23c698df14b33ede9
Author: steve <steve@designerwallcoverings.com>
Date:   Thu Aug 6 08:19:27 2026 -0700

    murals: fix selected mural not appearing (SVG thumbnails 400'd)
    
    thumbUrl built /thumb/.../200px-X.svg.png for SVG signatures, which Wikimedia
    returns 400 for — so nearly every grid cell broke and the mural rendered as a
    blank white box. Route SVGs through Special:FilePath?width=N (reliable PNG
    rasterizer, same as the app's sigImg). Verified all 6 murals now load 100% of
    images (was 0%). Also fixed drag-clamp to use the user's current mural size
    (murDims) instead of the fixed catalog size, so a resized mural stays on the wall.
---
 public/murals.html | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/public/murals.html b/public/murals.html
index f0b3bad..1b7d566 100644
--- a/public/murals.html
+++ b/public/murals.html
@@ -468,10 +468,16 @@ function murDims(){
            h: Math.min(16, Math.max(3, +$('#murH').value || 12)) };
 }
 const CELL_FT_W = 1.9, CELL_FT_H = 0.85;
-// Commons direct URL → 200px thumbnail (SVGs rasterize server-side)
-function thumbUrl(u){
-  const m = String(u||'').match(/^(https?:\/\/upload\.wikimedia\.org\/wikipedia\/commons)\/([0-9a-f])\/([0-9a-f]{2})\/(.+)$/);
-  if (m) return `${m[1]}/thumb/${m[2]}/${m[3]}/${m[4]}/200px-${m[4]}${/\.svg$/i.test(m[4])?'.png':''}`;
+// Commons URL → reliably-loadable thumbnail. Hand-built /thumb/…/200px-X.svg.png
+// paths 400 on Wikimedia for SVG originals (the signature images are mostly SVG),
+// which is what made selected murals render as a blank white box. Route SVGs
+// through Special:FilePath?width=N (302s to a rasterized PNG — the same mechanism
+// the mobile app's sigImg() uses). Raster originals + non-Wikimedia (e.g. Met)
+// URLs load fine as-is and pass through untouched.
+function thumbUrl(u, width = 200){
+  u = String(u || '');
+  const m = u.match(/^https?:\/\/upload\.wikimedia\.org\/wikipedia\/commons\/[0-9a-f]\/[0-9a-f]{2}\/([^/?#]+\.svg)$/i);
+  if (m) return `https://commons.wikimedia.org/wiki/Special:FilePath/${m[1]}?width=${width}`;
   return u;
 }
 function rosterFor(code){
@@ -579,7 +585,7 @@ function enableDrag(pxPerFt){
     const dyFt = (e.clientY-start.my)/pxPerFt;
     pos.x = start.px + dxFt;
     pos.y = start.py - dyFt;       // up = increase floor gap
-    const {W,H}=wallDims(), mw=CAT.size.widthFt, mh=CAT.size.heightFt;
+    const {W,H}=wallDims(), {w:mw,h:mh}=murDims();   // clamp to the user's CURRENT mural size, not the fixed catalog size
     pos.x = Math.min(Math.max(0,pos.x), Math.max(0,W-mw));
     pos.y = Math.min(Math.max(0,pos.y), Math.max(0,H-mh));
     el.style.left = pos.x*pxPerFt + "px";

← c148585 chore: bump mobile v1.0.0 → v1.1.0 (6-game suite, session cl  ·  back to CelebritySignatures  ·  auto-save: 2026-08-06T08:19:59 (1 files) — apps/mobile/packa 16ef809 →