Open SKBotNL opened 1 year ago
Does it happen with, for example, png images?
Does it happen with, for example, png images?
PNGs don't seem to even load.
hmmm, that seems odd - i wonder if something has changed internally in lime or hxcpp or something... bear with me, ill try this end (i would have expected webp to not work, unless that is supported by openfl / lime?)
OK, so can repro with the webp, which i think is probably valid because im guessing it doesnt support webp... although the error seems a little odd... (ill look into it).
I cant repro with a png, i tried: https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png
and it seemed fine... what url were you using?
Cheers, Ian
https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png
That png indeed works, others such as https://via.placeholder.com/600x400.png
and https://filesamples.com/samples/image/png/sample_1280%C3%97853.png
don't work
Seems fine this end... ill update all my libs, something must have changed? What versions of openfl, lime, haxe, etc are you running?
Seems fine this end... ill update all my libs, something must have changed? What versions of openfl, lime, haxe, etc are you running?
Can you share your code? Versions:
Actually, after some more testing, it seems that in this case html5 is actually having an issue
right, that also makes sense i think the browser is preventing haxe (not haxeui) from making that http request becuase the requested resources has said (CORS):
Access to XMLHttpRequest at 'https://filesamples.com/samples/image/png/sample_1280%C3%97853.png' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Access to XMLHttpRequest at 'https://via.placeholder.com/600x400.png' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
It may work if you deployed to a real domain rather than localhost (but probably not)
right, that also makes sense i think the browser is preventing haxe (not haxeui) from making that http request becuase the requested resources has said (CORS):
Access to XMLHttpRequest at 'https://filesamples.com/samples/image/png/sample_1280%C3%97853.png' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Access to XMLHttpRequest at 'https://via.placeholder.com/600x400.png' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
It may work if you deployed to a real domain rather than localhost (but probably not)
That makes sense, is there any way to add a Access-Control-Allow-Origin
header to the request?
well, Access-Control-Allow-Origin
comes from the server, not the browser, so the short answer is nope, it aint gonna happen. Maybe the http server you actually want to get images for is under your control? In which case you should be fine.
well,
Access-Control-Allow-Origin
comes from the server, not the browser, so the short answer is nope, it aint gonna happen. Maybe the http server you actually want to get images for is under your control? In which case you should be fine.
You're right. Lucky that is indeed the case.
OpenFL's Loader
does not seem to support WEBP, as you can see from this switch: https://github.com/openfl/openfl/blob/develop/src/openfl/display/Loader.hx#L434.
Should we create an issue in openfl/openfl
?
Expected Behavior
The resource should load
Current Behavior
When using an external image/web address as the resource of an image the built program for Windows errors with:\
haxe/ui/backend/AssetsImpl.hx:95: [IOErrorEvent type="ioError" bubbles=true cancelable=false text="Unknown error" errorID=0]
Steps to Reproduce (for bugs)
Test app / minimal test case
Your Environment