Code Monkey home page Code Monkey logo

magento2-clean-media's Introduction

Overview

The module provides a command for retrieving information about catalog media files.

bin/magento si:catalog:media

Media Gallery entries: 17996.
Files in directory: 23717.
Cached images: 353597.
Unused files: 5847.
Missing files: 4.
Duplicated files: 157.

The following options include more details in the output:

  • list all unused files with -u option
  • list all files referenced in database but missing in filesystem with -m option
  • list all duplicated files with -d option

Also it allows to clean up filesystem and db:

  • remove unused files with -r option
  • remove database rows referencing non-existing files with -o option
  • remove duplicated files and replace references in database with -x option

Installation

Run the following commands from the project root directory:

composer require sivaschenko/magento2-clean-media
bin/magento module:enable Sivaschenko_CleanMedia
bin/magento setup:upgrade

Usage

Information about media

bin/magento si:catalog:media

Media Gallery entries: 17996.
Files in directory: 23717.
Cached images: 353597.
Unused files: 5847.
Missing files: 4.
Duplicated files: 1.

List missing files

bin/magento si:catalog:media -m

Missing media files:
/i/m/image1.jpg
/i/m/image2.jpg
/i/m/image3.jpg
/i/m/image4.jpg

Media Gallery entries: 17996.
Files in directory: 23717.
Cached images: 353597.
Unused files: 5847.
Missing files: 4.
Duplicated files: 1.

List unused files

bin/magento si:catalog:media -u

Unused file: /i/m/image5847.jpg
...

Media Gallery entries: 17996.
Files in directory: 23717.
Cached images: 353597.
Unused files: 5847.
Missing files: 4.
Duplicated files: 1.

Remove unused files

bin/magento si:catalog:media -r

Unused "/m/i/mixer.glb" was removed

List duplicated files

bin/magento si:catalog:media -m

Duplicate "/i/m/image5847.jpg" to "/i/m/image5007.jpg"

Media Gallery entries: 17996.
Files in directory: 23717.
Cached images: 353597.
Unused files: 5847.
Missing files: 4.
Duplicated files: 1.

Removed unused files: 1.
Disk space freed: 1 Mb

Remove duplicated files

bin/magento si:catalog:media -x

Duplicate "/p/u/pub_1.jpg" was removed

Media Gallery entries: 2.
Files in directory: 4.
Cached images: 189.
Unused files: 2.
Missing files: 0.
Duplicated files: 1.

Removed duplicated files: 1.
Updated catalog_product_entity_varchar rows: 1
Updated catalog_product_entity_media_gallery rows: 1
Disk space freed: 1 Mb

magento2-clean-media's People

Contributors

peterjaap avatar sivaschenko avatar tdgroot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

magento2-clean-media's Issues

Class Sivaschenko\CleanMedia\Model\RemoveDuplicates does not exist

I can't run setup:di:compile anymore. I get this error:

In Generator.php line 139:

Class Sivaschenko\CleanMedia\Model\RemoveDuplicates does not exist
Class Sivaschenko\CleanMedia\Command\Duplicates\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:co
mpile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only.

the directory is writeable

Abandoned?

I see that no commits have been made to this extension since 2021. Is this extension abandoned, or are there plans to continue developing it?

removing missing images?

is there a way to remove missing images?

i can't seem to run catalog:images:resize cause there's a few missing images after transferring site contents from opencart. and it's quite a pain trying to locate those products only having image link.

thank you

Watermark images were deleted

Hi,
today I used your extension. Thanks.
First of all I thought it has deleted all images because all my product images wasn't shown anymore.
Then I figured out, that the extension also deletes the images from the /pub/media/catalog/product/watermark/ extension.
So you should exclude it.

Thanks

Stable version?

We have a pretty strict policy with our composer modules of only installing stable versions.

any chance you could tag a release version for the tool?

Cant intall in MC 2.3.2

Hello,
I got this message:

[InvalidArgumentException]
Could not find a version of package sivaschenko/magento2-clean-media matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.