It is possible to record the content of a folder in an array type variable and then go through it and display each element inHTML
The content that this folder will have are images and its content can only be modified by the administrator or owner of the site.
I ask this because I would not like to have to specify a label <img/>
for each image, but in a script have an array to go through it and through another text variable write the label with the src attribute to obtain each element of the array and at the end show the content of the variable with an innerHTML on the containing element.
It's not possible.
At least not from client, of course. From server you could use
fs
, for example.Alternatives (pretty crappy, really):
One option, depending on the file server and how it is configured, would be to make an ajax request to the route and for that route to return the list of files, being able to parse it as html and returning the nodes, but most likely you will find yourself with a 403.
Another option would be to generate, with a cron for example, a file that has the list of files to read it later.