diff --git a/public/admin.html b/public/admin.html
index 1ff47a0..17203ef 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -211,9 +211,24 @@ document.getElementById('compileBtn').addEventListener('click', async () => {
pairs.map((p) => loadImage('/data/photos/' + encodeURIComponent(p.photo)))
);
+ // 大圖先縮到長邊 1280px 再編譯:特徵品質足夠,
+ // 且 .mind 檔與掃描端(尤其 iOS Safari)的 WebGL 記憶體用量大幅下降。
+ // 曾發生 4 張 2244x4131 原圖直接編譯後,iPhone 掃任何照片都沒反應
+ // (桌面 Chrome 正常,iOS WebGL 資源上限較低,辨識引擎無聲掛掉)
+ const MAX_EDGE = 1280;
+ const compileInputs = images.map((img) => {
+ const scale = Math.min(1, MAX_EDGE / Math.max(img.naturalWidth, img.naturalHeight));
+ if (scale === 1) return img;
+ const c = document.createElement('canvas');
+ c.width = Math.round(img.naturalWidth * scale);
+ c.height = Math.round(img.naturalHeight * scale);
+ c.getContext('2d').drawImage(img, 0, 0, c.width, c.height);
+ return c;
+ });
+
status.textContent = '編譯特徵中(勿關閉頁面)…';
const compiler = new window.MINDAR.IMAGE.Compiler();
- await compiler.compileImageTargets(images, (progress) => {
+ await compiler.compileImageTargets(compileInputs, (progress) => {
bar.value = progress;
status.textContent = '編譯特徵中 ' + progress.toFixed(0) + '%(勿關閉頁面)…';
});