Crop Studio, Focus Points & Presets
Media combines focus-point-aware automatic cropping with an interactive darkroom Crop Studio and on-demand delayed transform rendering.
Focus-Point Aware Cropping
Section titled “Focus-Point Aware Cropping”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 examplehero_banner,route_card,og_card) andtitlewidth,height, andaspect_ratio(for example16:9,4:3,1200:630)format(auto,webp,avif,original) andquality(10to100)auto_generate(warm automatically on upload or viamedia:crops:warm),upscale, andwatermark_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.
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%to200%, 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 viaCropService::saveManualCrop()) setsis_manual = 1inentries_tbl_media_crops. Subsequent calls to$asset->ensureCrop(), focus-point updates,media:crops:warm, and defaultmedia:crops:clearnever overwrite a manual-locked crop unless explicitly reset (reset-cropor--include-manual).
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:
- Calling
$asset->ensureCrop(),$asset->render(), orsrcset()recordsstatus = 'pending'rows inentries_tbl_media_cropswithout blocking PHP execution. - On the first browser request,
TransformEndpointmaterializes the image once under an exclusive file lock:- Local public disks use
ProcessPageView::pageNotFoundso every subsequent request is served directly by the web server as a static file. - Remote disks serve through
/_media/transform/{assetId}/{file}.
- Local public disks use
- Warm pending rows ahead of traffic at any time with
php vendor/bin/wire media:crops:warm --pending.