image offers images alone and shows thumbnails; font offers font files alone.
max
1
How many files the field holds: 1 stores one id in a bigint column; any other number stores a JSON list in a text column, 0 meaning no limit.
public
false
The file is shown to people who are not signed in: the picker marks a private file and does not take it, a save refuses one, and a file the field holds cannot be made private.
A save links the picked files to the record under the field’s name; a
settings screen links them to its code. The file page lists the screens and
fields that use a file, and deleting such a file needs media.delete_linked.
use laterite_media::{link, Owner};
let owner = Owner { owner_type: "acme_posts", owner_id: "7", field: "gallery" };
link::set(&db, owner, &media_ids).await?; // in that order
let held = link::of_owner(&db, owner).await?;
let users = link::users_of(&db, first).await?;
link::clear_owner(&db, "acme_posts", "7").await?;
Call
Does
link::set(db, owner, media_ids)
Replaces what the owner’s field holds with media_ids, in that order.