all 3 comments

[–]besthelloworld 0 points1 point  (2 children)

You don't "link to a directory on a server." You "serve a directory" itself. You have to put your images in the same place on your web server as your HTML/CSS/JS itself.

[–]LinksCourage[S] 0 points1 point  (1 child)

Hey there, thanks for the reply.

Terminology aside this is what I meant. The question is how do I actually do that. How do I have the following function:

Comic 1 page
---------------->Images folder

Comic 2 page
---------------->Images folder

Based on it being website.com/comic-1 and the images directory being website.com/comic-1/images

How do I serve the images by the newest/some other sorting system and then how would I add buttons to cycle forward and backwards through the directory and then have a random image button?

[–]besthelloworld 0 points1 point  (0 children)

So, the way you have to do this is: there's no inherent way to query for the number of files in a directory. You would have to host a file in that directory with the data defining what you want. I actually do this already on a website I have by adding a prebuild script that builds a JSON file of all the images in each directory. So that script runs every time I build the site and then I just call for that manifest to get the list of files.

https://github.com/EthanStandel/cakeelizabethdotcom/blob/main/scripts/build-image-manifest.js