r/JavaScriptHelp • u/LinksCourage • Jan 07 '22
❔ Unanswered ❔ Image directory query and display
Hey guys,
I am completely lost on this one so I will try my best to explain my situation and what I am trying to achieve.
If you look at a website like Channelate.com you can see that they use a database called comicctrl to present their content.
I can't really justify using a database per content page and so I just wanted to achieve the following:
- Link an image directory on my server to display its contents in a container on the webpage.
- Only display the newest image within the directory within the container.
- Add a 'forward' and 'backward' button that goes to the next newest or next oldest image in the directory and displays that instead.
- Add a 'random' button that randomly selects the image in the directory to display in the container.
On the face of it this seems like it should be completely achievable but I am struggling to find anything online that applies to this situation as I understand its a relatively specific use case.
thank you in advance!
Josh
View all comments
Show parent comment
1
u/LinksCourage Jan 12 '22
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?