Libraries

Storage

Libraries whose media Hubstruct keeps itself, in S3-compatible storage. How files are stored, what's made from them, and what it can read.

A library keeps its media in Hubstruct's own storage (S3-compatible). You upload into it, and Hubstruct does the rest: it works out what each file is, makes its thumbnail and preview, and keeps your tags, favorites and trash itself.

Where the files go

Self-hosted, storage is the storage service: Garage, a small S3-compatible object store, with its files in a folder on the host (./data/storage by default). In the cloud, it's our storage.

Inside the bucket, each library has its own prefix:

text
libraries/<library id>/
  originals/<media id>                     the file as you uploaded it
  renditions/<media id>/thumbnail.webp     for tiles and grids
  renditions/<media id>/preview.webp       for the media page and the models
  mosaics/<hash>.webp                      album, tag and person covers

What it can read

KindTypes
ImagesJPEG, PNG, WebP, AVIF, TIFF
GIFsGIF
VideosMP4, WebM, MOV (QuickTime)

Anything else is refused at upload with a message saying why.

Not yet: HEIC (iPhone photos) and camera RAW files. The image library Hubstruct uses doesn't decode them in its standard builds, so they'd sit there unable to be processed. Convert them to JPEG first for now; support is planned.

What happens to an upload

  1. The upload streams the file straight into storage, never holding it all in memory, then creates the media. It appears in the library at once, as a placeholder.
  2. metadata reads the file's details: its dimensions, its length for a video, its date taken from EXIF, and its ThumbHash.
  3. renditions makes the thumbnail and preview. For a video, they're made from a frame a moment in.
  4. Every other step follows, as for any media. See Processing steps.

Every other step waits for the first two, since they work from the preview.

Videos

Videos are served as uploaded, with range requests so you can seek straight to any point. Hubstruct doesn't transcode, so a video your browser can't play (for example, HEVC in a browser without HEVC support) won't play in Hubstruct either, though it's still processed from its frames. MP4 with H.264 plays everywhere.

Tags, favorites and the trash

A library keeps everything in Hubstruct:

  • Tags, favorites and titles live in the database.
  • Emptying the trash deletes the original and its renditions from storage.

Deleting a library

Deleting a library deletes everything under its prefix in storage, meaning the originals, renditions and mosaics, along with its records. It asks first, naming how many media it holds. There's no undo: back up first if you might want them.