Skip to content

FieldtypeMedia & Page Integration

FieldtypeMedia and InputfieldMedia let editors attach centralized Media assets directly to ProcessWire Pages and Entries blueprints without duplicating files on disk.

Create a new field under Setup > Fields, choose Media (FieldtypeMedia), and configure its editorial controls on the Details and Input tabs:

Option Values / Type Description
maxItems int (0 = unlimited, 1 = single) Maximum attached assets (maxItems = 1 returns `MediaAssetItem
allowedKinds image, video, audio, document, embed, archive Restrict which asset kinds can be picked or uploaded into this field.
allowedExtensions comma/space list Per-field extension allowlist narrowing the global setting.
maxUploadBytes int Optional per-field maximum file size in bytes.
defaultDisk disk handle Default storage disk for direct uploads inside this field.
defaultFolder folder UUID Default library folder for direct uploads inside this field.
allowUpload bool Allow drag-and-drop or modal uploads directly from the field.
allowEmbed bool Allow importing YouTube/Vimeo embed URLs directly from the field.
allowOverrides bool Allow per-page overrides (such as custom alt text or caption) on attached items.
cropPresets preset handles Restrict or highlight specific crop presets on attached images.
gridMode grid or table Display attached items as visual cards or compact table rows.
gridRatio auto, 1:1, 4:3, 16:9, 3:4, 21:9 Aspect ratio used for thumbnail previews in grid mode.
gridSize 80 to 320 px Thumbnail card size in pixels.
sortable bool Enable pointer and keyboard reordering via SortableHandle.

Unified Tabbed Picker (MediaAcquisitionModal)

Section titled “Unified Tabbed Picker (MediaAcquisitionModal)”

Clicking Add Media inside InputfieldMedia opens the unified tabbed MediaAcquisitionModal:

  • Library: Browse folders, Smart Views, search, and select existing library assets.
  • Upload: Drag and drop files with browser-side resize controls (single-item fields also support drop-to-replace directly onto the card).
  • Stock Media: Search configured Unsplash, Pexels, or Pixabay providers and import in one click.
  • Embed: Paste a YouTube or Vimeo URL to import an embed asset with cached oEmbed thumbnail.

Attached items support in-place Quick Look, crop-preset preview, and multi-item bulk selection (Apply crop preset, Remove selected).

Querying Pages With FieldtypeMedia Selectors

Section titled “Querying Pages With FieldtypeMedia Selectors”

FieldtypeMedia joins entries_index transparently so you can query ProcessWire pages by referenced asset UUID, kind, or tags using standard $pages->find() selectors:

<?php
declare(strict_types=1);
namespace ProcessWire;
// Find pages referencing a specific Media asset UUID
$assetId = $this->wire()->sanitizer->selectorValue($asset->id());
$pagesWithHero = $this->wire()->pages->find("hero_media.asset_id={$assetId}, limit=50");
// Find pages whose hero_media field contains an image tagged "coastal"
$coastalPages = $this->wire()->pages->find('hero_media.kind=image, hero_media.tags*=coastal, limit=50');

Next steps