Tiger_Model_Media
@api· extendsTiger_Model_Table
Media — the file store's metadata (see migration 0018 + MEDIA.md).
The bytes live behind a Tiger_Media_Storage adapter (by disk + storage_key); this
model is the queryable metadata gateway: it classifies uploads by kind, owns the library
query, and resolves URLs (a public object's direct/CDN URL, else the ACL-checked streamer
route). Variants (thumbnails, previews) are a JSON map of derivative keys.
Methods
classify()
classify($extension)
Classify an upload by extension against the configured allowlists (media.allow.*). Returns the kind and whether it's allowed at all. pdf is split out of documents so it gets the pdf.js preview path.
$extensionstring— the upload's file extension (with or without leading dot)
Returns array{kind:string, — allowed:bool}
kindFolder()
kindFolder($kind)
The storage sub-folder for a kind — groups a tenant's files by type under its org path (<org>/images/…, /videos/…, /docs/…, /files/…): pdf+document → docs, archive+other → files. Used to build the storage key; the adapter adds the visibility root (public/ | private/) on top.
$kindstring— a KIND_* constant
Returns string — the storage sub-folder name
url()
url(array $media, $variant = null)
A usable URL for a media item (or one of its variants): the adapter's direct/CDN URL for public objects, else the ACL-checked streamer route. Accepts a row array.
$mediaarray— a media row (array)$variantstring|null— a variants key (e.g. 'thumbnail'); null/'original' = the file itself
Returns string — the resolved URL (direct/CDN or streamer route), or '' if none
variants()
variants(array $media)
Decode the variants JSON to an array.
$mediaarray— a media row (array)
Returns array — the variants map (derivative key => descriptor)
thumbUrl()
thumbUrl(array $media)
The best display URL for a thumbnail-sized preview (thumbnail variant, else original).
$mediaarray— a media row (array)
Returns string — the thumbnail (or original) URL
datatable()
datatable(array $opts)
DataTables source for the Media Library: kind filter, search across filename/title/ caption, sort, paginate. Query lives here; the service formats + ACL-gates.
$optsarray— query options (search, kind, limit, offset, orderCol, orderDir)
Returns array{total:int,filtered:int,rows:array}