Add a safe WP-CLI command for resizing oversized original uploads

Open
#254 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
wordpress
Domain
cli

Research direction

Start by reviewing the existing WP-CLI media command entry points and WordPress’s automatic large-image handling, then scope the proposed wp media resize-originals command. Done means bounded processing of JPEG, PNG, and WebP originals with dry-run savings, explicit confirmation, recovery guidance, metadata updates only, clear progress and failures, and no unrelated sub-size regeneration by default.

Written by the indexing model from the issue text.

Description

command:media

Feature Request

WordPress and WP-CLI provide excellent tools for generating image sub-sizes, but there is no first-class way to process oversized original uploads in a controlled, scriptable manner.

Many sites accumulate large camera originals that are far beyond their actual display needs. This increases storage, backup, CDN, and transfer costs. WordPress’s automatic large-image handling does not solve every existing-media or site-policy scenario.

I propose an opt-in command such as:

wp media resize-originals --max-dimension=1920 --quality=91 --dry-run

The command would:

  • process original uploads in bounded batches;
  • support JPEG, PNG, and WebP;
  • provide a dry-run with estimated storage savings;
  • require explicit confirmation before destructive changes;
  • preserve a recoverable backup or offer a documented backup strategy;
  • update only relevant attachment metadata;
  • never regenerate unrelated sub-sizes unless explicitly requested;
  • report progress and failures clearly.

@swissspidy is my secret spy

Dominant language
Gherkin
Stars
47
Forks
42
Avg merge
2h 30m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wp-cli/media-command

All issues in wp-cli/media-command

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.