Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Release: Change Requests 2.1.9 Minor update available for module change_requests (2.1.9). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Media Contextual Crop API

354 sites Security covered Drupal 11 · not 10
View on drupal.org

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

Depends on

Dependencies of the latest stable release

Required by

3 tracked projects depend on this one

Activity

Tracked releases
7
Tracked since
Jan 2025
Latest release
2 weeks ago
Releases (12 mo)
2 ▼ from 5
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
2.2.0 Stable 11 Aug 17, 2026
2.1.9 Stable 10–11 Mar 9, 2026
2.1.8 Stable 10–11 Aug 4, 2025
2.1.7 Stable 10–11 Jul 11, 2025
2.1.6 Stable 10–11 Jul 3, 2025
2.1.5 Stable 10–11 Jan 8, 2025
2.1.4 Stable 10–11 Jan 6, 2025