PHPackages                             cap/cleanmedia - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. cap/cleanmedia

ActiveMagento2-module[CLI &amp; Console](/categories/cli)

cap/cleanmedia
==============

Magento 2 CLI Command : remove images of deleted product in the `/media/catalog/product` folder

2.0.0(6y ago)2914.4k—1%14[4 issues](https://github.com/cap340/CleanMedia/issues)PHP

Since Nov 20Pushed 5y ago6 watchersCompare

[ Source](https://github.com/cap340/CleanMedia)[ Packagist](https://packagist.org/packages/cap/cleanmedia)[ RSS](/packages/cap-cleanmedia/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (19)Used By (0)

CleanMedia
==========

[](#cleanmedia)

Magento 2 CLI Command : remove images of deleted product in the `/media/catalog/product` folder

based on [EAV Cleaner Console Command](https://github.com/magento-hackathon/EAVCleaner/tree/magento2) from [FireGento e. V. - Hackathons](https://github.com/magento-hackathon)

---

Purpose of this module

- scan the `media/catalog/product` folder including `/cache`
- find all images used by products in the db :
    `catalog_product_entity_media_gallery_value_to_entity` table gives `value_id` of images.
    `catalog_product_entity_media_gallery` table gives `value` (real path)
- delete all files in the `media/catalog/product` folder NOT USED by any products.
- delete related records in database.

---

Installation
------------

[](#installation)

Copy all files in `/path/to/magento/app/code/Cap/CleanMedia`
Run commands :
`php/bin magento module:enable Cap_CleanMedia`
`php/bin magento setup:upgrade`

---

Commands
--------

[](#commands)

`php bin/magento cap:clean:media --help`
`php bin/magento cap:clean:media`
`php bin/magento cap:clean:media --dry-run`
`php bin/magento cap:clean:media --no-cache`
`php bin/magento cap:clean:media --dry-run --no-cache`

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 58.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~111 days

Total

16

Last Release

1906d ago

Major Versions

1.3.0-RC1 → 2.0.0-beta12020-01-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4c69244b1708a52abc673bf25f8cb16734dfa268adaaff787ae715df8a2159?d=identicon)[ph2m\_vma](/maintainers/ph2m_vma)

---

Top Contributors

[![cap340](https://avatars.githubusercontent.com/u/42498660?v=4)](https://github.com/cap340 "cap340 (24 commits)")[![UrbanSurfers](https://avatars.githubusercontent.com/u/15006128?v=4)](https://github.com/UrbanSurfers "UrbanSurfers (12 commits)")[![frithjof](https://avatars.githubusercontent.com/u/1432985?v=4)](https://github.com/frithjof "frithjof (3 commits)")[![trevorneo](https://avatars.githubusercontent.com/u/54083272?v=4)](https://github.com/trevorneo "trevorneo (1 commits)")[![Tsquare17](https://avatars.githubusercontent.com/u/19720119?v=4)](https://github.com/Tsquare17 "Tsquare17 (1 commits)")

### Embed Badge

![Health badge](/badges/cap-cleanmedia/health.svg)

```
[![Health](https://phpackages.com/badges/cap-cleanmedia/health.svg)](https://phpackages.com/packages/cap-cleanmedia)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
