Each Module in your application can have its own predefined image crops and roles.
A role is a way to define different contexts in which an image might be placed. For example, roles for a
People model could be
cover. This would allow you to include your People model in list and show a cover image for each, or show a single person model with a profile image. You can associate any number of image roles with your Model.
Crops are more self-explanatory. Twill comes with some pre-defined crop settings to allow you to set different variants of a given image, so crops can be used in combination with roles, or they can be used on their own with a single role to define multiple cropping ratios on the same image.
Using the Person example, your
cover image could have a
square crop for mobile screens, but could use a
16/9 crop on larger screens. Those values are editable at your convenience for each model, even if there are already some crops created in the CMS.
The only thing you have to do to make it work is to compose your model and repository with the appropriate traits, respectively
HandleMedias, set up your
$mediasParams configuration and use the
medias form partial in your form view (more info in the CRUD section).
When it comes to using those data model images in the frontend site, there are a few methods on the
HasMedias trait that will help you to retrieve them for each of your layouts. You can find the full reference in the HasMedias API documentation