HTML File that watches folder and displays images

Discussion in 'Web Design and Development' started by Miles.Kelly97, Apr 25, 2018.

  1. Miles.Kelly97 macrumors member

    Nov 24, 2015
    Tunbridge Wells
    Not sure if this is a stupid question.

    But can you say have a HTML file index.html sitting in a folder that looks at an images folder and will render whatever is in that folder with certain styling.

    The catch is the images folder can be added to so can it watch all new files added and render them.

    Any suggestions would be great

  2. D.T. macrumors G3


    Sep 15, 2011
    Vilano Beach, FL
    OK, so HTML is static, that is, the layout, links to images, etc., are written into the markup, so an index.html file (with just html/css) won't be able to do this alone - if I'm reading your question correctly.

    So a typical architecture for something like this would be to pass the image content through an app layer, maybe normalize the filenames, add them some sort of DB, then store them (on a filesystem, or better yet, on some object storage like Amazon S3). The point, is the image meta content (the filename, type, path, etc.) would be selected from a DB resource, and the links to images built from that (more on this later).

    You _could_ also have an app layer that deals directly with the files, that is, reads the filesystem for content, builds the links (in the HTML), recurses directory structures (not sure if content can be packaged into it's own folder structures).

    So all I've really said is: files are uploaded (through some mechanism), app reads information from a DB (if that's part of the process) or directly from a filesystem (or cloud storage, whatever ...)

    On the user facing side, the HTML/UI, there needs to be an application layer of some sort that can do this! Kind of a super simple example, would be an app layer, running on a web server, using some language that does the <whatever> and renders the output as HTML. Each time the page is rendered (visited the first time, refreshed) it loads whatever is present in the DB (or filesystem). This is very simple, but requires a web server, an app layer, coding in that app context using the required language/framework.

    Think of how this forum works: you come to a page, the forum application layer generates all the page resources: html, css, the user content like image uploads, and then renders out what you see.

    Now there are several different ways to solve this, with varying degrees of sophistication, you could build part of the app in the front end (javascript in the browser) that polls a web service that runs on the backend that provides the functionality of reading the DB or F/S. Then you could implement something where the page updates occur without a page refresh, the images would just dynamically appear in the page as the underlying resources were updated (i.e., images uploaded, or removed)
  3. Miles.Kelly97 thread starter macrumors member

    Nov 24, 2015
    Tunbridge Wells
    Ok cool, thats what I thought. I didn't want to dive in without checking that I wasn't overcomplicating things

Share This Page