Last active
December 22, 2015 08:29
-
-
Save omarrr/6445056 to your computer and use it in GitHub Desktop.
Revisions
-
omarrr revised this gist
Sep 5, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ function downloadCapture(forceDownload) if (forceDownload) image = image.replace("data:image/png;base64", "data:application/octet-stream;base64"); window.open(image, "_blank"); } // If you'd rather save the image directly, change the value for 'true' -
omarrr revised this gist
Sep 5, 2013 . 1 changed file with 6 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,13 @@ function downloadCapture(forceDownload) { var canvas = document.getElementById("canvas"); var image = canvas.toDataURL("image/png"); if (forceDownload) image = image.replace("data:image/png;base64", "data:application/octet-stream;base64"); window.open(image); } // If you'd rather save the image directly, change the value for 'true' downloadCapture(false); -
omarrr created this gist
Sep 5, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ function downloadCapture(forceDownload) { var canvas = document.getElementById("canvas"); if (canvas.getContext) { var ctx = canvas.getContext("2d"); var image = canvas.toDataURL("image/png"); if (forceDownload) image = image.replace("data:image/png;base64", "data:application/octet-stream;base64"); window.open(image); } else { console.log("something went _really_ wrong.") } } // If you'd rather open the image in a new tab, change 'true' for 'false' downloadCapture(true);