Created
August 12, 2024 01:39
-
-
Save mecaneer23/1257ef9c503e2444d2c2c55a2db3ee4f to your computer and use it in GitHub Desktop.
Image creation from external url example
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 characters
| console.log("Image creation from external url example"); | |
| async function createLocalImageFrom(imageUrl) { | |
| let blob = fetch(imageUrl).then(r => r.blob()); | |
| let img = document.createElement("img"); | |
| img.src = URL.createObjectURL(await blob); | |
| document.body.appendChild(img); | |
| } | |
| // createLocalImageFrom(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment