diff --git a/system2-report/web/js/issue-report.js b/system2-report/web/js/issue-report.js index e67424c..ad2c05e 100644 --- a/system2-report/web/js/issue-report.js +++ b/system2-report/web/js/issue-report.js @@ -1090,22 +1090,38 @@ function resizeImage(file, maxSize, quality) { /** * 사진 슬롯 업데이트 + * 브라우저가 렌더링 못하는 포맷(HEIC 등) 은 img 대신 placeholder 로 표시하되 + * photos[index] 데이터 자체는 유지해서 업로드는 정상 동작. */ function updatePhotoSlot(index) { const slot = document.querySelector(`.photo-slot[data-index="${index}"]`); + // 기존 img 나 placeholder 제거 + const existingImg = slot.querySelector('img'); + if (existingImg) existingImg.remove(); + const existingPlaceholder = slot.querySelector('.photo-placeholder'); + if (existingPlaceholder) existingPlaceholder.remove(); + if (photos[index]) { slot.classList.add('has-photo'); - let img = slot.querySelector('img'); - if (!img) { - img = document.createElement('img'); + const data = photos[index]; + // 브라우저가 로 렌더링 가능한 포맷만 img 사용, 그 외엔 placeholder + const isRenderable = /^data:image\/(jpeg|jpg|png|gif|webp|bmp|svg)/i.test(data); + + if (isRenderable) { + const img = document.createElement('img'); + img.src = data; slot.insertBefore(img, slot.firstChild); + } else { + // HEIC 등 렌더링 불가 포맷 — placeholder 표시 (업로드는 정상) + const ph = document.createElement('div'); + ph.className = 'photo-placeholder'; + ph.style.cssText = 'width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#ecfdf5;color:#059669;font-size:0.625rem;font-weight:600;text-align:center;gap:2px;'; + ph.innerHTML = '
📷
HEIC
첨부됨
'; + slot.insertBefore(ph, slot.firstChild); } - img.src = photos[index]; } else { slot.classList.remove('has-photo'); - const img = slot.querySelector('img'); - if (img) img.remove(); } } diff --git a/system2-report/web/pages/safety/issue-report.html b/system2-report/web/pages/safety/issue-report.html index 01d68c4..3adbdf0 100644 --- a/system2-report/web/pages/safety/issue-report.html +++ b/system2-report/web/pages/safety/issue-report.html @@ -783,6 +783,6 @@ - + diff --git a/system3-nonconformance/web/m/management.html b/system3-nonconformance/web/m/management.html index cd90489..90ef1cf 100644 --- a/system3-nonconformance/web/m/management.html +++ b/system3-nonconformance/web/m/management.html @@ -96,7 +96,7 @@
-

※ 비어있는 슬롯에만 자동 채움. 기존 사진은 유지됩니다.