Load image through url

Is there a way to load a image from a URL to a wick project? Not through the asset library.

Can you download the image?

Yes, it is possible, but you’ll need an image base. Here’s a simple working example:
URL to Image.wick (30.0 KB)
In this example, you should be able to write your forums username, select an image scale, and you should see your wick editor forums profile picture inside the project.

How this works:
Takes the image object after breaking it apart, and changes the src attribute to the URL.

The load script is only there for testing purposes. Feel free to copy the clip into your project and use the addImg function to achieve what you need :+1:

#demos-and-tutorials

1 Like

To download an image from a url, you can use the following code:

var dl = document.createElement('a');
dl.download = "name.png";
// Enter link below, I'll use my pfp as an example
dl.href="https://forum.wickeditor.com/user_avatar/forum.wickeditor.com/hamzah_al_ani/240/12241_2.png"
dl.click();

To download an image of the project, I just published a new version of the vcam that does that, you can use it, or just paste this code inside of a default script:

Then type

screenShot("name.png")

anywhere to download an image file of the project.

1 Like

After some messing around with the code, I fixed for my needs (i forgot what they were exactly but eh) and it worked!

Thanks!

1 Like

pretty sure you can drag and drop the image to add it into the asset library, but more often than ever, the complex way is more flexible.