Provides basic API for Media Contextual Cropping. This module is just a plugin type & service provider.

Please look at the other modules of the Context Cropping Familly

Configuration

This is the base/Api module, for using Contextal Cropping Capabilities please check the implementation :

- Media Contextual Cropping Embed
- Media Contextual Cropping Reference

And the crop plugin supported :

- Media Contextual Cropping Focal Point Adapter
- Media Contextual Cropping Image Widget Crop Adapter

Branches

1.x

Legacy branch, generating copies of source image.

2.x

New approach based on context in crops.

How fix the error EntityStorageException: "'context' not found" :
This version use this patch on CROP module.
Please be sure the patch are applied (composer reinstall drupal/crop) and the Database Structure Update are applied too ( crop_update_8006 ).

Please check Bug & Tips

How it's work

Saving contextual crop data

- On referenced field
For media referenced fields, the Media Contextual Cropping Reference module will use media_library_media_modify (waiting core feature resolution) in order to set and save contextual Crop Data

- On embed Media
For embed Media, the the media_contextual_crop_field_embed module provide a CKeditor 5 plugin in order to invoke a modal for setting crop Data.
These data are saved in the drupal-media html node inside the wysiwyg.

Render multiple derivativ from the same media/image with the same style (but different crop)

This is bigger issue with this kind of functionality. The Drupal Core ImageStyle processing CAN NOT (By Design) produce more than one derivativ for one couple Image/Style.
The CROP API, just add the capability to "choose" the part of the image.

In order to avoid this problem, MediaContextualCrop modules (2.x) branch are based on a specific image_formater (replacing the core one) to generate a contextualized URL.

"Et voila"

1.x to 2.x Update process

The central point of this migration is the use of a specific "Contextual Crop Image" format on the media image field.
This formatter must be present on the image field to use the contextual crop.
A Drush command ( drush media_contextual_crop:migrateToImageFormater ) can do the configuration changes automatically (only on media entites and if the chosen image style uses a crop).

How to

A documentation are updated here

Supporting organizations: 

Project information

Releases