IMG

IMG is a simple image stream generated using mk(1).
Drop a mkfile and some images in a directory, run mk, and you'll get a web page, JSON feed, and Atom feed.

TODO:

Using it

One time-setup:

  1. Satisfy the prerequisites.
  2. Stick the mkfile in a directory your web server can get at.
  3. Modify the definition of BASEURL in the mkfile.
  4. The first time you run 'mk' it'll create "_header", "_footer", "_jsonhead", and "_atomhead" files.
    You'll need to edit those, replacing the all-caps strings with more sensible local values. Keep the last line of _header, _jsonhead, and _atomhead, and the first line of _footer, as they are. The provided defaults are very simple, but you are free to implement navigation, a sidebar, include javascript, whatever.
  5. The default mk target will make index.html, feed.json, and index.atom files suitable for their normal purposes. An "index" file (with no extension) is created and updated during operation. The created index.html references img.css; none is provided, but the img.css I use should be suitable. File names starting with an underscore are also reserved.
  6. Optionally, add an entry in cron to run "mk" in this directory, In case you forget to run it yourself after making changes or creating a new entry. I run it every 10 minutes.

To create an entry:

  1. Create an image file with a recognized extension.
    We recognize the extensions jpeg, jpg, gif, and png (regardless of case). You can add others by editing the mkfile:\^TARG line.
  2. Optionally, add alt text (highly encouraged) and/or a caption.
    Create a text file with the same name as the image, plus ".alt" for the alt text and ".caption" for the caption.
  3. Run 'mk' (optional if you created the 'cron' entry).
    This will add any new image file names to _timestamps if this is the first time we're seeing it, and then regenerate "index", "index.html", "index.atom", and "feed.json", as needed.

Other notes

Prerequisites:

On Plan 9:

You'll need my datefmt and stat programs.

On unix:

(This is expected to work but is completely untested.)
You'll need Plan 9 from User Space installed, and in your $path or $PATH before the normal unix tools.
You'll also need datefmt and stat, like above.

Reserved words/patterns:

Notes:


Inspired by the version at Texto-Plano.
Made in CN85 by Anthony.