If the picture is on Facebook - I can open it on canvas, edit and download, and if the picture is on the same server where my website is (000webhost.com), I get an error:
Access to Image at ' https://xxx.000webhostapp.com/ava1.png ' from origin ' https://xxx.000webhostapp.com ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
function Up() { //Π·Π°Π³ΡΡΠ·ΠΊΠ° Π»ΠΎΠ³ΠΎΡΠΈΠΏΠ° var ctx = document.getElementById('canvas').getContext('2d'), img = new Image(); img.crossOrigin = "anonymous"; img.src = "https://graph.facebook.com/1387819034852828/picture?width=150&height=150"; img.onload = function() { ctx.drawImage(img, 0, 0, 480, 400); } } function download() { //ΡΠΊΠ°ΡΠΈΠ²Π°Π½Π΅ ΠΊΠ°ΡΡΠΈΠ½ΠΊΠΈ var dt = canvas.toDataURL('image/jpeg'); this.href = dt; };