cloakwp/save-image-as-new

Save WordPress image-editor crops, rotates, and scales as a new media item instead of overwriting the original.

Maintainers

Package info

github.com/cloak-labs/cloakwp-save-image-as-new

Type:wordpress-muplugin

pkg:composer/cloakwp/save-image-as-new

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-20 17:09 UTC

This package is auto-updated.

Last update: 2026-08-20 17:21:36 UTC


README

Adds Save as New (and Scale as New) to WordPress’s media library image editor — crop, rotate, flip, or scale without overwriting the original attachment.

Configured in PHP, no settings UI, no admin notices, no premium upsells.

Install paths

1. Composer (must-use plugin) — recommended

composer require cloakwp/save-image-as-new

Package type is wordpress-muplugin. With composer/installers configured, that installs to:

wp-content/mu-plugins/save-image-as-new/

(Your project may map that path differently — e.g. Bedrock uses public/app/mu-plugins/.)

Important: WordPress core only auto-loads PHP files directly in mu-plugins/. It does not load plugins nested in subdirectories like mu-plugins/save-image-as-new/save-image-as-new.php. You need an autoloader (or a tiny stub) for subdirectory must-use plugins.

Recommended: Roots Bedrock Autoloader — it scans mu-plugins/*/*.php for plugin headers and includes them. Ships with Bedrock; usable in any WordPress project as roots/bedrock-autoloader. Once loaded, this package shows under Plugins → Must-Use (not the toggleable Plugins list).

Without an autoloader, add a one-line stub at the mu-plugins root:

<?php
// wp-content/mu-plugins/save-image-as-new-loader.php
require WPMU_PLUGIN_DIR . '/save-image-as-new/save-image-as-new.php';

Optional fluent config in your theme functions.php (runs before the deferred default boot):

use CloakWP\SaveImageAsNew\SaveImageAsNew;

SaveImageAsNew::make()
  ->titleSuffix(' (edited)')
  ->register();

If you never call register(), the plugin bootstrap starts with defaults on init priority 1.

2. Traditional plugin install (download as a zip)

For sites that don’t use Composer — install it like any other WordPress plugin:

  1. Open the GitHub repository page.
  2. Click the green Code button, then Download ZIP.
  3. Unzip the file. You’ll get a folder named something like cloakwp-save-image-as-new-main.
  4. Rename that folder to save-image-as-new (optional but keeps the Plugins list tidy).
  5. Install it in either way:
    • WordPress admin: Plugins → Add New → Upload Plugin → choose the zip (re-zip the renamed folder if you renamed it) → Install Now → Activate, or
    • Manually: upload the save-image-as-new folder into wp-content/plugins/ on your server (via FTP/SFTP or your host’s file manager), then go to Plugins and click Activate.

Same defaults as the Composer path. Developers can still override config via fluent register() or the config filter (below). No mu-plugin autoloader needed.

Fluent API

SaveImageAsNew::make()
  ->copyTaxonomies(true)   // default; copies attachment taxonomies such as media categories
  ->titleSuffix('')        // optional suffix appended to the new attachment title
  ->register();

Config filter

add_filter('cloakwp/save-image-as-new/config', function ($config) {
  return $config->withTitleSuffix(' (edited)');
});

After a successful save, cloakwp/save-image-as-new/copied fires with (int $newId, int $sourceId) if you need to copy extra meta.

How it works

On the media library image editor (crop / rotate / flip / scale):

  • Save as New appears next to Save Edits. It duplicates the original file, applies the queued edits to the copy, and leaves the original attachment untouched.
  • Scale as New appears next to Scale and does the same for a downscale.

The new item keeps the original title, caption, description, alt text, and (by default) taxonomy terms. Filename is uniqued in the uploads folder (photo-1.jpg, etc.).

When Save as New runs inside a media modal (including ACF Gallery / Image “Edit Image”), the modal switches to the new attachment. An ACF Gallery or Image field that opened that modal replaces the original ID with the new one.

Architecture (Core + Plugin)

src/Core/      # Config, duplicate + apply-edits domain
src/Plugin/    # Admin JS enqueue, AJAX
SaveImageAsNew.php  # Fluent facade

Development

composer install
composer test

License

LGPL-3.0-only