fix: a PNG the phone cannot open whole is read in bands, not charged as a manual check
Some checks failed
Build and deploy / Validate source (push) Successful in 1m17s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled

A 57 MB sheet failed to decode on a phone (out of memory), so the Site took it
for a file the browser cannot read: +R$ 2,00 a metre and "O navegador não abre
PNG". Its size was already known; it now goes the large-file way.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-27 09:15:23 -03:00
parent 8af6d576e9
commit 70837e2e06

View File

@@ -339,7 +339,10 @@ function medirFolha(file){
const L=larguraFilme(), measure={larg:L,alt:+(d.h/d.w*L).toFixed(1),
fonte:'dimensões do arquivo',dpiFolha:Math.round(d.w/(L/2.54)),px:d.w};
if(d.h>32767 || file.size>GRANDE_BYTES) return res({...measure,grande:true,tall:d.h>32767});
carregarImagem(file).then(img=>res(img&&img.width?{...measure,fonte:'proporção da imagem'}:null));
// A PNG the phone cannot open whole (out of memory, a 57 MB sheet on
// 26/11) is read in bands like a large one, never sent to the manual
// check: its size is already known.
carregarImagem(file).then(img=>res(img&&img.width?{...measure,fonte:'proporção da imagem'}:{...measure,grande:true}));
}).catch(()=>res({rejected:true,reason:'Não foi possível ler o PNG. Exporte novamente.'}));
return;
}