Crop Locations
A crop location represents a named placement in your frontend — a hero banner, a product thumbnail, a social share image — where a specific crop will be used. Selecting a location in the cropper auto-populates the crop key and links to a preset.
Creating a location
Extend Codezone\MediaZone\Media\MediaLocation and implement the required properties:
Registering locations
Add the class to config/media.php:
Properties
Property | Type | Description |
|---|---|---|
| string | Unique crop key — matches the key stored in |
| string | Human-readable name shown in the location dropdown |
| string | Fully-qualified preset class to apply when this location is selected |
| array | Default breakpoints pre-selected when location is chosen |
| array | Optional guide line overlays (see below) |
Guide lines
Guide lines are visual overlays on the crop canvas that mark safe zones or bleed areas. Each line is an array with axis (x or y) and position (a fraction of the image dimension, 0–1):
Guide lines are rendered as coloured overlays on the canvas and do not affect the saved crop data.
Using crops in templates
Retrieve a crop URL for a specific location key:
Check whether a crop exists for a location: