=== Thumbnail Manager === Contributors: yoohw Tags: thumbnails, orphan, media, images, cleanup Requires at least: 6.3 Tested up to: 6.8 Requires PHP: 7.4 Stable tag: 1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Clean up unused thumbnails with progress; find orphan -WxH files; disable sizes for future uploads. == Description == Thumbnail Manager helps you take back disk space from oversized Media Libraries. **What it does** - **Prune Files:** Select the image sizes you want to **KEEP**. The plugin scans your `/uploads/` folder and targets all *non-selected* registered sizes for removal. It shows a **dry-run** summary first, then lets you delete in **batches** with a live **progress bar**. - **Orphan discovery:** Finds on-disk files that match `-WxH` patterns (including `.jpg.webp`, `.bak.jpg`, retina `@2x`, and duplicate `-1` suffixes) even if those sizes are no longer registered. Aggressively deletes **any** `-WxH` files that don’t exactly match the sizes you chose to keep (use with care). - **Subfolder scope:** Limit scans to a specific year/month inside `uploads/` for faster, safer runs on large libraries. - **Thumbnail Sizes:** Choose which sizes should be **generated for future uploads**. Disabled sizes won’t be created at upload time (and are hidden from size pickers). **What it doesn’t do** - It **does not regenerate** thumbnails. Use a regeneration plugin if you need to rebuild sizes after changing settings. - It never deletes original full-size images. **Who is it for?** Site owners, editors, and developers who’ve accumulated many custom image sizes (themes, page builders, sliders) and want to reduce storage bloat safely. == Features == - Two-tab UI: **Prune Files** & **Thumbnail Sizes** - **Dry-run** mode with sample matches before any deletion - **AJAX progress bar** and **batch deletes** to avoid timeouts - **Orphan `-WxH` discovery** report and delete found dimensions - **Limit to subfolder** (All, year, or year/month) - **Disable sizes for future uploads** (does not unregister core sizes; simply prevents generation) - Hides disabled sizes from Media size dropdowns (optional filter) - Works per-site on single and multisite (run on each site as needed) == Installation == 1. Upload the plugin folder to `/wp-content/plugins/` or install via the Plugins screen. 2. Activate the plugin. 3. Go to **Tools → Prune Thumbnails**. == Usage == ### Prune Files 1. In the table, **check** the sizes you want to **KEEP** (e.g., `thumbnail`, `medium`, `large`, and optionally `medium_large`). 2. (Optional) Choose a **subfolder** (e.g., `2024/11`) for a quicker, safer trial run. 3. Make **Orphan discovery** ON to see a report or do a deletion of found dimensions. 4. Click **Run** with **Dry-run** selected to preview matches. 5. Review results → switch to **Delete** when you’re confident. **Tip:** Enable **Orphan discovery** only when you want to remove any extra `-WxH` sizes not exactly matching your KEEP list (great for cleaning legacy sizes like `-1200x860` or `.bak.jpg` files). ### Thumbnail Sizes 1. Uncheck any sizes you no longer want generated for **future** uploads. 2. Click **Save changes**. (This prevents those sizes from being created going forward; existing files are unaffected until you prune them in Prune Files Tab.) == Frequently Asked Questions == = Will this delete my original images? = No. It only targets derivative thumbnails that match registered sizes you did **not** keep or `-WxH` patterns from discovery. Originals are not deleted. = Do I need to back up first? = Yes, always back up your site and uploads before deleting files. = What’s “Orphan discovery”? = - **Orphan discovery**: scans and **reports** all `-WxH` files found on disk (even if unregistered). = Does it unregister sizes? = Core sizes aren’t unregistered. For future uploads, the plugin prevents generation using filters. Custom sizes may be unregistered late during `init` (optional), but it’s not required to stop generation. = Multisite support? = Yes, run it per site from **Tools → Prune Thumbnails**. = Can it regenerate thumbnails? = No. This plugin focuses on pruning and preventing generation of unwanted sizes. == Screenshots == 1. **Prune Files** tab with size checkboxes, subfolder select, and progress bar. 2. **Thumbnail Sizes** tab to disable sizes for future uploads. == Technical Notes == - Prevent generation via: `intermediate_image_sizes_advanced` (removes disabled sizes at upload time). - Optionally hide in UI via: `image_size_names_choose` and reduce the base list via `intermediate_image_sizes`. - Auto-scaled big image can be disabled with `big_image_size_threshold` if desired (not enabled by default). - Requires capability `manage_options`. == Changelog == = 1.0 = * Initial release. * Prune Files: Dry-run/report, batch deletion with progress, subfolder scope. * Orphan `-WxH` discovery; optional Strict mode for unmatched dims. * Thumbnail Sizes: disable generation for future uploads. == Upgrade Notice == = 1.0 = New plugin. Back up your uploads before running deletes, and start with Dry-run. == Privacy == This plugin does not collect personal data or send data to external services. It only reads and modifies files within your `/uploads/` directory based on your actions.