src attribute of img tag

Hey everyone, is there a way to make the src attribute of an img detect an image name in subfolders?
3 Replies
NazCodeland
NazCodelandOP3y ago
If I have a folder named, images which contains 2 sub-folders, filled and outline, I want to do something like,
<img src="images/**/1.png" alt="">
<img src="images/**/1.png" alt="">
Jochem
Jochem3y ago
that's not up to the browser, but up to the server the browser doesn't know where the files on the server are and can only request a specific one if you want to accomplish this, you'll need something listening server-side that checks for the files existing and sends the right one based on whatever logic you want to use alternatively, you could try to load both files in javascript, and then set the src to the one you want, but from the client you'd still have to explicitly check each file with an exact path
NazCodeland
NazCodelandOP3y ago
@jochemm Got it, thank you very much for the help.
Want results from more Discord servers?
Add your server