load from URL error

Just started using Construct 2? Post your questions here

Post » Mon Jun 30, 2014 1:36 pm

Hey guys,

I was just checking out the sprite load from URL action. so when i keep a textbox for the user to add the link and sprite should load the image from the link it does not work for me. When the URL is something like
, it does not work but when it is some other loooong URL that starst with sumting like
data:blah blah
, it displays the image. any help please.

Thanks,
Ashwin
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Fri Jul 04, 2014 1:25 am

It may be that the server you're loading the image from does not give you permission to load the image.
Check the error log(console) in your browser by pressing F12.
I've tried it for you and here's the result in a screenshot:
Image
B
6
S
1
Posts: 73
Reputation: 571

Post » Fri Jul 04, 2014 1:32 am

Ah! So there's no way we can load an image? @Tom , @ashley . Any help guys?
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Fri Jul 04, 2014 1:34 am

You would have to host it on your own website / hosting service to give permission to yourself probably.
B
6
S
1
Posts: 73
Reputation: 571

Post » Fri Jul 04, 2014 1:35 am

Tried. No success.
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Fri Jul 04, 2014 1:36 pm

The server must explicitly indicate that the image is allowed to be loaded from different domains using the Access-Control-Allow-Origin HTTP header. In the screenshot given above, it appears the gstatic.com owners deliberately don't want you to load their images remotely, likely for security reasons. It's up to the server operator if they allow that.
Scirra Founder
B
400
S
236
G
89
Posts: 24,546
Reputation: 195,471

Post » Fri Jul 04, 2014 4:15 pm

Got it. @ashley , @rezagamertag any help on how I could determine the link typed in by the user is usable or not and explain to them ? Our how I could make it work better ?
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Fri Jul 04, 2014 9:07 pm

I think you're going to have to tell us more about what you're trying to do.
Maybe there are other ways of doing it.
B
6
S
1
Posts: 73
Reputation: 571

Post » Sat Jul 05, 2014 1:06 am

sure. I was making a web app with many of my games in it . In this, i also added a thing called quick links where u can add the url , name of website and url to load website logo from. When u press ok, a sprite is formed which has the logo loaded from url as image , the name in a textbox below it and loads the website from url on click.
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Sat Jul 05, 2014 7:42 am

There's no easy way to tell other than trying to load the image and seeing if it works. Perhaps you could try using the new file chooser plugin - it allows the user to select a local file instead of loading one off the web, and the local file should always load.
Scirra Founder
B
400
S
236
G
89
Posts: 24,546
Reputation: 195,471

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests