feat: a PNG that records 200 DPI or more offers its own size, Manter, and the Prumo says if it was kept (Rodada 5, A1)

The Site reads the pHYs chunk of a loose art; at 200 DPI or more the
size in the file is the default width and a Manter button sits before
the table sizes (also when the art is turned 90 degrees). The source
carries saved_width_cm and saved_dpi, used only by the Prumo report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 11:11:21 -03:00
parent 7e33e6fb1d
commit 7fc091a1bd
8 changed files with 121 additions and 4 deletions

View File

@@ -296,6 +296,11 @@ function medir(a){
return dimensoesImagem(a.f).then(async d=>{
if(!d || !(d.w>0) || !(d.h>0)){ a.decodeError=true; return a; }
a.px=d.w; a.py=d.h; a.prop=d.h/d.w; a.grande=true;
a.dpiSalvo=await dpiSalvoPng(a.f);
if(a.dpiSalvo>=200){
a.cmSalvo=Math.round(a.px/a.dpiSalvo*2.54*10)/10;
if(a.cmSalvo>=1 && a.cmSalvo<=larguraFilme() && !a.cm) a.cm=a.cmSalvo;
}
// WebP cannot be read in parts (JPG is refused): the art is placed by its
// measurements, as a full box, and the team checks it before printing.
if(!/\.png$/i.test(a.f.name)){ a.semPrevia=true; return a; }
@@ -315,7 +320,13 @@ function medir(a){
}).catch(()=>{ a.decodeError=true; return a; });
}
return carregarImagem(a.f).then(async img=>{
if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height; a.src=img.src; a.miniSrc=miniatura(img); a.fotoSrc=miniatura(img,480,720);
if(img){ a.prop=img.height/img.width; a.px=img.width; a.py=img.height;
a.dpiSalvo=await dpiSalvoPng(a.f);
if(a.dpiSalvo>=200){
a.cmSalvo=Math.round(a.px/a.dpiSalvo*2.54*10)/10;
if(a.cmSalvo>=1 && a.cmSalvo<=larguraFilme() && !a.cm) a.cm=a.cmSalvo;
}
a.src=img.src; a.miniSrc=miniatura(img); a.fotoSrc=miniatura(img,480,720);
// Read at its own pixels while the customer sets the width.
a.lendoArte=true;
mapaDaImagem(img, a.px/300*2.54).then(m=>guardaMapaDaArte(a,m)).catch(()=>{})