[Plugin] Load Image from URL at runtime

0 favourites
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • I finished my first plugin. It will allow you to load an image from an URL at runtime. The image position/size is determined by where you place the object in the Layout screen.

    You can download it from the following link:

    LoadURLPlugin

    Thank you!

  • This is cool, thanks Juantar!

  • thx man. good and useful plugin

  • It's a useful plugin, but currently it miss some important functionalities.

    Currently the image is loading in an unexpected position. In the layout editor the object has a centered hotspot, but in runtime the image has a top-left hotspot staying offset by half width and half height. It would be nice if you could choose the hotspot position in the properties panel like the Tiledbackground object, at least for the most relevant positions like top-left and center.

    It would also be handy to have an "on image loaded" condition to trigger events when the image finished downloading and is displaying. And a "get image url" expression would also be very handy.

    I suggest you to add a "set width" and "set weight" action, as well as a "get image width" and "get image weight" expressions to be able to proper control how an image is displayed. It would also be extremely important to have a "set position" action, as well as a "get X position" and "get Y position" expressions. It also misses basic actions for any visual plugin like "set opacity", "set visibility", and Z ordering actions.

    Now I'm thinking that maybe it would be easier to mod a Tiledbackground plugin and add the load image from url functionality since all the other stuff are already in there.

    I'm really interested in this plugin, hope you can make it more complete.

  • Thank you, Animmaniac, for your suggestion. I went ahead and created a new plugin ("Tiled Background From URL") based on the Tiledbackground plugin. It is pretty much the same plugin with the addition of allowing you to load the image at runtime and a condition that will let you know when the image has been loaded. I tested the hotspot and Opacity and they worked. I was not able to make the effects works. Anybody with more experience on Construct effects is more than welcome to mod this plugin to make it work with effects. The new download link is below:

    Download new mod

  • Hi!

    This is what I was looking for! Something to load images dynamicaly, but I just can't get this to work... it doesn't load my image :/ Can you post an example, please?

    Thanks in advance!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is a small sample project:

    https://sites.google.com/site/jptarqu/downloads/loadimage_test.zip?attredirects=0&d=1

    One caveat (bug?) of the plugin is that it needs at least one sprite to be added to the layout. If there are no sprites, the image loaded from the URL won't draw into the canvas.

    Also, I have not tested the plugin with the webgl option of the latest release.

  • Thanks, but in your example the image that should be loaded doesn't show up everytime I run it, that's what happens when I try to load an image :/

  • : your plugin is good. I can even make it load base64 string representing images ! However, when I do that, (and the base64 is local), the image doesn't update in realtime. Do you have a solution ? (I think it's the same problem for Leos...)

  • I recently noticed that the tiled background version of the plugin will only load the images if called from certain conditions like "start layout".

    The original version of the plugin (link at the first stop) should work when called from any condition as long as there is a sprite in the layout.

    unfortunately, I will not be able to work on fixing the plugins for a few weeks, so if anybody wants to you are more than welcome to modify the source code and release the fixes.

    Thank you all for your feedback!

  • Thank you for this post! Could you post an example file? - I'm a total newbie...!

    Regards

    Jens

  • klukke: There should be a sample file named "loadimage_test.zip" in https://sites.google.com/site/jptarqu/downloads.

    Thanks

  • I can't really get either (tiledbackgroundfromurl, or loadurl) plugin to work very reliably. By disabling WebGL I can get loadurl to display an image on Firefox (though not on Chrome). The tiledbackgroundfromurl plugin makes use of a wait_for_textures call which I think is only useable in the object constructor, thus disabling the ability to load pictures at runtime. I do appreciate the hard work you put into this plugin though.

    Thanks,

    -- cacotigon

  • : to make it work reliably, you need to use a trigger on the "onload" function.

  • Hi, i have the same problem. The plugin doesn't seem to work when the webgl is on. But when its off, it works. but the game lags as usual.

    I can't really get either (tiledbackgroundfromurl, or loadurl) plugin to work very reliably. By disabling WebGL I can get loadurl to display an image on Firefox (though not on Chrome). The tiledbackgroundfromurl plugin makes use of a wait_for_textures call which I think is only useable in the object constructor, thus disabling the ability to load pictures at runtime. I do appreciate the hard work you put into this plugin though.

    Thanks,

    -- cacotigon

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)