Skip to content

Uploads, Browser Resize & Naming Rules

Media ships a native browser upload engine built for large creative teams, combining client-side optimization, resumable chunked transfers, automatic filename rules, Stock Media search, and video/embed poster capture.

Click Upload in the library header to open Upload Studio (UploadStudioModal):

  • Browser-Side Optimization (imageResizer.ts): Uses native createImageBitmap and <canvas>.toBlob() to downscale oversized raster images (JPG, PNG, WebP) before transfer. Pick Original, 1920px, 2560px, 4K (3840px), or custom dimensions, tune JPEG/WebP quality (50 to 100%), toggle WebP conversion, or check Keep original per file. Animated GIF/WebP, SVG, PDF, video, and audio files pass through untouched.
  • Global Defaults (Media::uploadClientDefaults()): Configure site-wide defaults under Setup > Media > Settings > Uploads & Privacy (client_resize_enabled, client_max_width, client_max_height, client_quality, client_convert_webp).
  • SHA-256 Duplicate Handling: Choose Reuse existing asset or Allow duplicate right inside Upload Studio before starting the transfer.
Upload Studio stages files with optional browser-side resizing, WebP conversion, disk/folder selection, and duplicate detection.

Persistent Upload Queue Dock & Chunked Transfers

Section titled “Persistent Upload Queue Dock & Chunked Transfers”
  • Upload Queue Dock (UploadQueueDock): Stays docked while you keep browsing. Shows live XMLHttpRequest.upload.onprogress percentages, bytes transferred, throughput (MB/s), 3-way concurrent uploads, per-file cancel (AbortController) and retry, duplicate badges, and 1-click Inspector links.
  • Resumable Chunked Uploads: Files larger than 4 MB automatically split into 2 MB chunks (upload-init, upload-chunk, upload-complete, upload-abort via $media->chunks()) with up to 2 automatic retries per chunk. Stale incomplete sessions are pruned daily by MediaMaintenanceTask.
  • Clipboard Paste: Press Cmd/Ctrl+V anywhere in the library to upload clipboard images directly into the active folder.

Automatic Upload Filename Renaming & Storage Paths

Section titled “Automatic Upload Filename Renaming & Storage Paths”

Configure naming and directory behavior under Setup > Media > Settings > Naming & Paths:

  • Storage Path Mode (upload_path_mode):
    • date_uuid (default): Immutable YYYY/MM/{uuid}/{file} paths so links never break when Pages or Entries are renamed.
    • context_path: Semantic pages/{template}/{slug}/{file} or entries/{type}/{name|title|shortId}/{file} paths with automatic -2 deduplication.
  • Explorer Folder Mode (upload_folder_mode): Choose field_or_root (default) or auto_context (automatically assigns folders by template or Entry type).
  • Filename Renaming (UploadNameFormatter): Enable rename_enabled, set rename_default_format, optionally cap length with rename_max_length, and add ordered media_rename_rule blocks scoped by source (page, entry, library), template/type, field name, and file extensions. Supported tokens:
    • {original}, {name}, {title}, {template}, {type}, {field}, {folder}
    • [Y-m-d] (any PHP date() format), randstring[n], and ### zero-padded sequential counters.
    • Leave filename_format blank on a matching rule to keep the original filename.

Built-In Stock Media & Video/Embed Posters

Section titled “Built-In Stock Media & Video/Embed Posters”
  • Stock Media Providers (Unsplash, Pexels, Pixabay): Add write-only API keys under Settings > Stock Media & Labels to search and import licensed photos directly into your library with attribution metadata ($media->stock()->search('unsplash', 'coast') / $media->stock()->import(...)). Register custom providers via Media::registerStockProviders.
  • YouTube / Vimeo Embeds & Custom Posters: Import external videos via $media->importUrl('https://www.youtube.com/watch?v=...') or the Embed tab in MediaAcquisitionModal. Local video uploads capture a browser-side JPEG poster frame automatically (videoPoster.ts, zero ffmpeg required), and embeds cache local oEmbed thumbnails. Editors can upload or reset a custom poster (<= 1280px, _posters/{asset_id}.jpg via attachPoster() / removePoster()) exposed uniformly through $asset->posterUrl() and privacy-friendly $asset->embedHtml(['facade' => true]).

Next steps