diff --git a/static/index.html b/static/index.html index 0cc0add..dbafdcd 100644 --- a/static/index.html +++ b/static/index.html @@ -2615,9 +2615,20 @@ // Show thumbnail in scan photo preview const reader = new FileReader(); + reader.onerror = function() { + const ocrEl = document.getElementById('scanOcrResult'); + if (ocrEl) ocrEl.textContent = '❌ Could not read file — unsupported format or corrupted. Try a JPEG screenshot instead.'; + const preview = document.getElementById('scanPhotoPreview'); + if (preview) preview.style.display = 'block'; + }; reader.onload = async function(e) { const thumb = document.getElementById('scanPhotoThumb'); if (thumb) thumb.src = e.target.result; + thumb.onerror = function() { + const ocrEl = document.getElementById('scanOcrResult'); + if (ocrEl) ocrEl.textContent = '❌ Image format not supported in browser. Try a JPEG screenshot.'; + thumb.style.display = 'none'; + }; const preview = document.getElementById('scanPhotoPreview'); if (preview) preview.style.display = 'block';