Core Concepts & Architecture
Media sits in the Entries-dependent domain layer (Inertia -> React -> Entries -> Media). It uses hidden Entries blueprints for metadata and Managed SQL Tables for high-volume relational records, keeping ProcessWire’s pages table completely clean.
flowchart LR
UI["ProcessMedia (Setup > Media) & InputfieldMedia"] --> SVC["Media Service ($wire->media)"]
SVC --> BP["Hidden Entries Blueprints (assets, folders, presets, settings)"]
SVC --> SQL["Managed SQL Tables (crops, usage, shares)"]
SVC --> ENG["ImageEngine (Intervention Image v4.4: Vips -> Imagick -> GD)"]
SVC --> DISK["DiskRegistry (public, private, S3/R2, SFTP, FTP)"]
Storage Schema (Zero pages Table Pollution)
Section titled “Storage Schema (Zero pages Table Pollution)”Hidden Entries Blueprints
Section titled “Hidden Entries Blueprints”| Blueprint | Purpose |
|---|---|
media_assets |
Stores asset metadata, localized title/alt/caption, asset_kind, dimensions, sha256, phash, focus_top/focus_left, color_labels, approval_status, embargo_until, file_version, and owner. |
media_collections |
Stores physical folders (is_folder = 1 with parent_id hierarchy) and curated or dynamic Smart Collections (is_folder = 0 with smart_rules). |
media_crop_presets |
Stores named crop presets (handle, width, height, aspect_ratio, format, quality, auto_generate, upscale, watermark_enabled). |
media_settings |
Singleton holding all global settings rendered inline across 6 tabs in Setup > Media > Settings. |
media_disk_config |
Repeatable block blueprint for remote Flysystem v3 storage disks inside media_settings. |
media_rename_rule |
Repeatable block blueprint for scoped automatic upload filename renaming rules. |
Managed SQL Tables
Section titled “Managed SQL Tables”| Table | Purpose |
|---|---|
entries_tbl_media_crops |
Tracks generated and pending delayed crop variations, manual-lock flags (is_manual), file paths, dimensions, and composite indexes (idx_asset_manual, idx_status). |
entries_tbl_media_usage |
Indexes every asset reference across ProcessWire Pages (FieldtypeMedia), Entries fields, and Tiptap rich text (data-media-id). |
entries_tbl_media_shares |
Stores public share gallery records with SHA-256 token_hash, expiration, password hash, atomic download counters, and idx_active_created. |
Public Editorial Library vs Module Private Vaults
Section titled “Public Editorial Library vs Module Private Vaults”Every asset in Media belongs to one of two strictly isolated worlds:
- Public Editorial Library (
owner = 'site',visibility = 'public',hidden_from_library = 0): Browsable in Setup > Media, selectable inFieldtypeMedia/InputfieldMediaand Tiptap dialogs, eligible for responsive rendering, public shares, andHeadless/Seodelivery (subject toisPublished()approval and embargo checks). - Module-Scoped Private Vaults (
owner = '<module>',visibility = 'private',hidden_from_library = 1): Created exclusively via$media->uploadPrivate($owner, $source). Fail-closed excluded from library browsing, pickers, public shares, andHeadless. Served only through HMAC-SHA256 signed download URLs (/_media/download/{token}) after passing owner policy authorization.
Core PHP Entities
Section titled “Core PHP Entities”MediaAssetItem(Totoglu\Media\Entity\MediaAssetItem): Immutable domain wrapper around amedia_assetsentry exposing ProcessWire-familiar properties, crop/responsive helpers, visual intelligence (dominantColor,palette,imageHash), andsignedUrl().MediaAssetArray(Totoglu\Media\Entity\MediaAssetArray): TypedWireArraycollection returned by$media->find()and multi-valueFieldtypeMediafields.