Skip to content

Crop Studio, Focus Points & Presets

Media combines focus-point-aware automatic cropping with an interactive darkroom Crop Studio and on-demand delayed transform rendering.

Every image stores focus_top and focus_left coordinates (0 to 100, defaulting to 50, 50). Automatic variations compute the exact crop rectangle centered on the focal point via ImageTransformPipeline::computeFocusCropRect(), keeping subjects framed across landscape, square, and portrait aspect ratios.

Named Crop Presets (Setup > Media > Crop Presets)

Section titled “Named Crop Presets (Setup > Media > Crop Presets)”

Define reusable presets in Setup > Media > Crop Presets (media_crop_presets blueprint) with:

  • handle (unique machine key, for example hero_banner, route_card, og_card) and title
  • width, height, and aspect_ratio (for example 16:9, 4:3, 1200:630)
  • format (auto, webp, avif, original) and quality (10 to 100)
  • auto_generate (warm automatically on upload or via media:crops:warm), upscale, and watermark_enabled

From this screen, administrators can warm presets synchronously, click Queue (mode=queue) to dispatch background Totoglu\Media\Queue\WarmPresetQueue jobs (HTTP 202), or process queued variations from the On-Demand Delayed Crops bar.

Setup > Media > Crop Presets manages named variation presets, batch warming, background queue jobs, and pending delayed crops.

Crop Studio Darkroom & Manual-Lock Protection

Section titled “Crop Studio Darkroom & Manual-Lock Protection”

Open Crop Studio (CropStudioModal) from the right-click context menu, Quick Look, or the Asset Inspector Drawer:

  • Switch between all configured presets in the left preset rail, toggle aspect-ratio lock vs freeform framing, zoom from 50% to 200%, inspect low-resolution upscale warnings, or switch into Focus Point placement mode.
  • Manual-Lock Protection (is_manual = 1): Saving a frame in Crop Studio (or via CropService::saveManualCrop()) sets is_manual = 1 in entries_tbl_media_crops. Subsequent calls to $asset->ensureCrop(), focus-point updates, media:crops:warm, and default media:crops:clear never overwrite a manual-locked crop unless explicitly reset (reset-crop or --include-manual).
Crop Studio locks custom manual frames per preset (is_manual = 1) so automated crop warming never overwrites art-directed crops.

On-Demand Delayed Transforms (delayed_transforms)

Section titled “On-Demand Delayed Transforms (delayed_transforms)”

Enable Delayed Transforms in Setup > Media > Settings > Crops & Watermark (or $config->media['delayed_transforms'] = true) to keep initial page TTFB fast even on image-heavy pages:

  1. Calling $asset->ensureCrop(), $asset->render(), or srcset() records status = 'pending' rows in entries_tbl_media_crops without blocking PHP execution.
  2. On the first browser request, TransformEndpoint materializes the image once under an exclusive file lock:
    • Local public disks use ProcessPageView::pageNotFound so every subsequent request is served directly by the web server as a static file.
    • Remote disks serve through /_media/transform/{assetId}/{file}.
  3. Warm pending rows ahead of traffic at any time with php vendor/bin/wire media:crops:warm --pending.

Next steps