[Plugin] Load Image from URL at runtime

Forum Home Forum Home > Construct 2 Development > Plugins for Construct 2
 Post Reply Post Reply Page  12>
Author
2,834 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Topic: [Plugin] Load Image from URL at runtime
    Posted: 01 Nov 2011 at 10:06pm
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!
Back to Top
7,784 Rep
Post Options Post Options   Quote Jayjay Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 2011 at 6:02am
This is cool, thanks Juantar!
Jayjay =]
Back to Top
1,732 Rep
Post Options Post Options   Quote zurtri Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 2011 at 8:24am
thx man. good and useful plugin
Back to Top
6,033 Rep
Post Options Post Options   Quote Animmaniac Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 2011 at 1:49am
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.
Personal Portfolio: www.prr-art.com
Back to Top
2,834 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Posted: 05 Nov 2011 at 2:34pm
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
Back to Top
2,069 Rep
Post Options Post Options   Quote Leos Quote  Post ReplyReply Direct Link To This Post Posted: 17 Nov 2011 at 4:36am
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!
Back to Top
2,834 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Posted: 17 Nov 2011 at 7:09pm
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.
Back to Top
2,069 Rep
Post Options Post Options   Quote Leos Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 9:05am
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 :/
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 22 Nov 2011 at 10:22am
@juantar: 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...)
Back to Top
2,834 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Posted: 23 Nov 2011 at 12:15pm
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!
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down