1 |
- const t=async(t,e)=>{const n=new Image;n.setAttribute("crossOrigin","anonymous"),n.onload=()=>{const t=document.createElement("canvas");t.width=n.width,t.height=n.height;t.getContext("2d").drawImage(n,0,0,n.width,n.height);const o=t.toDataURL("image/png"),a=document.createElement("a"),c=new MouseEvent("click");a.download=e||"photo",a.href=o,a.dispatchEvent(c)},n.src=t};export{t as d};
|