How to fix AJAX to PHP image with CORS?

Get help using Construct 2

Post » Sat Mar 16, 2013 12:07 am

Hi guys, I wanted to use AJAX method to get progress time instead of Load URL image from Sprite, it didn't work to me.




CAPX


There is my PHP script:



<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: image/jpg');
readfile('http://flamma-beta.com/HTML5/asuka.jpg');
?>



Any ideas?

Thanks!
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Sun Mar 17, 2013 4:11 am

Bump
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Sun Mar 17, 2013 4:54 am

Sounds like your issue is with the php script which does not return an image.
But PHP is out of the scope of the C2 forum, try to check stackoverflow.com in case some snippet of code might already be there.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sun Mar 17, 2013 6:43 am

@Kyatric this is a solution i've found about php script would return an image. (Are you making assumptions?)

http://stackoverflow.com/questions/4494704/return-the-contents-of-an-image-in-php-file


This .capx can get an image and it worked, but i wanted to change from Load URL to AJAX to get progress, in this case it didn't work.Joannesalfa2013-03-17 06:45:30
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Sun Mar 17, 2013 11:04 am

Probably you should use the custom behavior inject base64 string in a sprite.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sun Mar 17, 2013 12:19 pm

@Kyatric Thanks, i'm going to use it.
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644


Return to How do I....?

Who is online

Users browsing this forum: jeffige, Mallets and 24 guests