Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This Drupal module provides a foundational API for creating contextual crops for media. It works by offering plugin types and services that other modules in the "Context Cropping Family" can build upon to enable specific cropping features for media references and embeds.

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

Activity

Total releases
4
First release
Jul 2025
Latest release
4 months ago
Releases (12 mo)
2
Maintenance
Active

Release Timeline

Releases

Version Type Release date
2.1.9 Stable Mar 9, 2026
2.1.8 Stable Aug 4, 2025
2.1.7 Stable Jul 11, 2025
2.1.6 Stable Jul 3, 2025