daypress
admin route/d-admin/upload · /d-admin/media-new
doc versionv1.0.4
reading time5 min read
section group07 · Content & Editorial
Docs/Content & Editorial
/d-admin/upload · /d-admin/media-new5 min readv1.0.4

Media Library DAM, AVIF/WebP Pipeline & Focal-Point Crops

Every image uploaded to Media → Library (/d-admin/upload) or POST /wp-json/wp/v2/media runs through Daypress's pure-Rust image pipeline for responsive resizing, AVIF/WebP transcoding, and zero-CLS dimension tracking.

Automatic AVIF/WebP encoding & responsive crops

  • Responsive Sizes & Next-Gen Formats: Uploading a JPEG or PNG records intrinsic width and height (eliminating Cumulative Layout Shift) and generates thumbnail, medium, and large derivatives alongside modern WebP and AVIF files under uploads/.
  • Immutable Edge Caching: Static media responses emit Cache-Control: public, max-age=31536000, immutable and ETag headers for instant browser and CDN caching.
  • Built-in SVG Sanitizer: Uploaded .svg vectors are parsed and stripped of <script> elements, javascript: URIs, and inline on* event handlers before hitting disk.
http://localhost:8090/d-admin/upload — Media Library DAM & Virtual Folders
Daypress Media Library screen showing virtual folder sidebar, uploaded plate preview, grid/list view toggle, and bulk asset tools
Media -> Library (/d-admin/upload) organizes uploads into virtual folders without changing public /uploads/* URLs.

Virtual folders, focal-point picker, in-place replace & hygiene

  • Virtual DAM Folders (daypress_list_media_folders): Group attachments into hierarchical folders (e.g., Editorial Plates, Case Studies, Icons). Because folders are metadata-only, moving an asset never breaks existing URLs.
  • Interactive Focal-Point Crop Picker: Click any image in the Media Inspector to place a focal crosshair—Daypress outputs matching CSS object-position coordinates so card thumbnails never crop out faces or UI subjects.
  • 1-Click Replace File in Place: Upload an updated screenshot or PDF directly inside an existing attachment record to regenerate all AVIF/WebP crops while keeping the exact same attachment ID and URL across every page.
  • Unused Asset Scanner (daypress_scan_unused_media): Scans all post_content, layout_json AST nodes, ACF fields, and theme templates to list orphaned attachments safe for cleanup.

Uploading media programmatically (REST multipart & MCP)

bash
# Option A: Standard WordPress REST v2 multipart upload
curl -X POST https://example.com/wp-json/wp/v2/media \
  -u "admin:abcd efgh ijkl mnop" \
  -F "file=@./hero-diagram.png" \
  -F "alt_text=System architecture overview"

# Option B: MCP base64 upload via daypress_import_wp_bundle
# Registers the attachment in SQLite and writes /uploads/hero-diagram.png
DayStudio Image Rule: daypress_import_html_design does not auto-download external https:// hotlinks or inline data:image/ URIs. Always upload assets to the Media Library and point AST Image nodes to /uploads/<file_name>. For S3/R2 cloud offload, see Production Hosting, TLS, R2/S3 & Hot Cache.