FotobogenDocumentation

Modules

A module changes how photographs look: black and white, a film border, your name in the corner. The files you uploaded are never changed, so switching a module off always gets the photo back exactly.

Switching a module on

Three modules come with Fotobogen. All of them start switched off. Open Admin, Modules and switch on the ones you want. Then use them in either of two ways:

When a look changes, the copies visitors see are made again in the background, one photo at a time. A photo shows as "processing" in the library until its turn is done.

The edit page previewing a photo inside a film border with sprocket holes, above a strip of small previews of different film looks
Choosing a look for one photo.

A skin can set a look for all photos when you choose it. The Rangefinder Dreams skin does this, with black and white.

Film looks

The tone and grain of a kind of film.

LookWhat you get
B&W 400 (Tri-X style)Classic black and white: firm contrast, visible grain
B&W 400 pushed, heavy grain (Tri-X style)Hard contrast and coarse grain, as from film pushed in development
B&W 100, fine grainSmooth, gentle black and white
Colour slide (Kodachrome style)Saturated colour with deep blacks
Colour negative, softMuted colour, lower contrast

These are impressions built from ordinary adjustments, not measured copies of any product. The film names say only which familiar look each one is after; Fotobogen is not connected with their makers.

Film frame

Makes a photo look contact printed: the negative's black border around it, on white paper, with the film's edge showing.

The frame makes the picture larger, so the photo itself is not covered.

Watermark

Prints a line of text, such as your name, on each photo: in a corner or the centre, at a size and opacity you choose, light or dark. It marks the copies visitors see, and the copy they download, except when show where photos were taken is on in Settings: the download is then the file exactly as you uploaded it, unmarked. It is a deterrent, not protection: a mark in a corner can be cropped off.

The text is drawn in dots, like the printing on the edge of film, so no font has to be installed on the server. That limits it to capital letters, digits, and a few marks: small letters are printed as capitals, anything else is left as a space, and (C) stands in for the copyright sign.

Sharpening

Each module has a sharpening slider, from 0 to 100.

SettingResult
0None
25Normal: what a print or a scan is usually given. Film looks starts here.
60 and upCrisp, with visible bite at edges: the look of a sharp lens on black-and-white film. The Rangefinder Dreams skin uses 60.

The photo is sharpened and the grain is laid on afterwards, so turning sharpening up does not make the grain harsher. The film frame and the watermark start at 0 and leave the photo alone unless you ask.

Using several together

A look can have more than one step. Set in the admin, they run in the order the modules are listed: film looks first, then the frame, then the watermark, so grain is not printed on the border and the mark sits on top of everything.

Adding a module

  1. Copy the module's folder into data/modules/ on the server.
  2. Restart Fotobogen.
  3. Switch it on under Admin, Modules.

Nothing is rebuilt. Some systems compile their admin, so adding a plugin means building the whole admin again. Fotobogen's admin has no code for any particular module: a module says what settings it has ("a number from 2 to 14 called thickness"), and the admin draws a slider, a menu, a checkbox, or a text field for each.

A module is trusted code. It runs inside the server with the server's permissions, like a WordPress plugin. Install only modules you have read or trust. For that reason there is no way to install one through the admin: it has to be put on the server's disk by someone who can log in to the server.

Writing a module

A module is a folder with two files: module.json, which names it, and a JavaScript file that says what settings it has and what it does to a picture. This is a whole module:

// data/modules/sepia/index.mjs
export default {
  transforms: [
    {
      id: 'tone',
      label: 'Sepia tone',
      description: 'Black and white, tinted warm.',
      params: {
        warmth: { type: 'range', label: 'Warmth', min: 0, max: 100, step: 5, default: 60 },
        fade: { type: 'boolean', label: 'Faded blacks', default: false },
      },
      apply(image, params) {
        const amount = params.warmth / 100
        let toned = image.removeAlpha().tint({ r: 128 + 40 * amount, g: 128 - 6 * amount, b: 128 - 60 * amount })
        if (params.fade) toned = toned.linear(0.9, 20)
        return toned
      },
    },
  ],
}

There is nothing to install or import. image is a sharp pipeline, and anything sharp can do to a picture is available on it.

Two commands, run from a copy of the source, start a module and tell you whether it works before you put it on a site:

pnpm fotobogen module new my-module     # writes a working example to data/modules/my-module/
pnpm fotobogen module test my-module    # runs it on a test picture and reports

That is the short version. Writing a module is the full guide: every field, the four kinds of setting, five worked examples, testing, installing, and every error message.

What a module cannot do

A module changes the picture, and can change its size up to 40 megapixels. It cannot add screens to the admin, change a photo's title or other details, or alter the uploaded file.

Back: Writing a skin Next: Writing a module