i’m using import picture like that :
const advancedTextureImage = GUI.AdvancedDynamicTexture.CreateForMesh(plane);
const image = new GUI.Image(’ ', ‘./assets/images/’ + file.name);
the probleme is i want to use a dynamic Url (from any path) to accept any picture from any folder .
A URL is a URL, whether local or from a different domain. You need to make sure that the domain accepts CORS (otherwise the request will fail), but other then that it doesn’t matter what URL you are entering.
Hi @RaananW, good to see you, hope you are well. I brought a Gui 2d imageControl demo home (zip DL) and tried… file:///sameDirAsIndexHtml/img.png - no joy. Maybe need some localHost url… or maybe need a local web server? And ideas about those things? thx.
./img.png didn’t work, but that’s not a url, as you pointed out.
localhost? port 8080? Local images need to come from locally-running webserver? 2-slash? 3-slash?
Sorry if I’m causing trouble. I am also reading about this stuff… as fast/hard as possible. I don’t mean to be a pain, but I/we/others might need more answer details, perhaps. thx! (all commenters welcome, of course.)
@Wingnut, ./img.png is a url. It is a url path relative to the html file location.
@Viche, if you mean you wish to relative path to folders higher than dot, e.g. ../../../../image.png, web servers are going to block you trying to read anything above. That would a major security problem.
On a sightly different tac, I run all my scenes during development, some being very large tools with also read files, from file://mypage.html. It avoids a local web server, which is just another point of failure, & caching might mean you are not seeing the latest files.
Chrome does not allow reading anything but other JS files with a file:// html file. Edge does, but you cannot use microphones. My preferred is Firefox, but they recently are blocking too. To unblock on Firefox just:
change privacy.file_unique_origin to False in about:config
That is a tinyUrl version of a Google IMAGE search for cow and wikimedia (at same time) with TOOLS tab set-to “Labeled For ReUse”. Generally, all wikimedia images are CORS-clear (and I hear Facebook images are, as well, and surely some others).