This module helps identify and prevent duplicate media files from being uploaded to your Drupal site. It can generate reports of existing duplicates or actively block new duplicate uploads, with options to control how strictly duplicates are handled.
This module allows the comparison, detection and restriction of duplicate media
entities within a site.
Cleaning up the duplicate media items is currently outside the scope of this module. That's because it's a hard task. Depending on media usage in fields, usage across translations, usage in token embedded media, usage in config (blocks, etc).
Merge duplicates
3.x implements an experimental feature to media entities detected as duplicates. Use with care and report feedback.
Installation
- To install this module,
composer requireit, or place it in your modules folder and enable the module. - Generate initial checksums if you have existing media items. You can use the form linked from the status page or run the
drush media-duplicates:checksums:rebuildcommand. (Currently only supports Drush 9+)
Usage
- Install this module as early as possible in your development process to reduce any technical debt you later have to clean up.
- Module allows progressive enhancement by having settings that
- Allow you to generate a report but don't restrict duplicates.
- Restrict new duplicates but still allow you to save existing.
- Restrict all duplicates, both new and existing.
- Use in conjunction with Entity Usage to help find where duplicates are used and consolidate.
Plugin architecture
This module allows media type developers to implement a MediaDuplicatesChecksum plugin to integrate with this module.
Alternatives
- https://www.drupal.org/project/media_dupe_detect seems to be very similar - would be great if someone could do a comparison. Also see #3517939: Difference with similar modules and possible combining efforts?
- https://www.drupal.org/project/entity_reference_manager seems to be a helpful tool for media merging. While it might not be ideal for mass-merging, it might be an alternative to merge only certain media entities
Ask your assistant about Media duplicates
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- media Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.