LC Smart Media Redirect & Cleaner
High-performance image size redirect engine, orphan scanner, prune tool, thumbnail regeneration, and image size manager for WordPress.
Install in
LC Smart Media Redirect & Cleaner keeps your Media Library lean without ever breaking a front-end
image. It intelligently redirects missing/mismatched thumbnail-size requests to the closest
available size instead of letting them 404 or silently regenerate on every request, scans for
orphaned metadata and unused files, and gives you a safe, reviewable prune tool.
Features:
- Adaptive CPU Load Throttling & Background Engine — Real-time server CPU load monitoring (
get_server_cpu_load()) with dynamic batch pacing, cooling backoffs, and safe execution. - Smart Core Web Vitals (LCP) Booster & Hero Preload Engine — Automatically detects hero images, strips
loading="lazy", injectsfetchpriority="high"anddecoding="async", and outputs high-priority<link rel="preload">in<head>. - Master Original Image Dimension Cap & Auto-Downscaler — Resizes oversized raw master camera/iPhone uploads in place (e.g. capped at 2560px or 2048px) to eliminate hosting bloat.
- Native WP-CLI Command Suite — Comprehensive terminal management via
wp smrc stats,wp smrc regen,wp smrc prune, andwp smrc redirect. - Interactive Visual Quality & Savings Comparison Modal — Apple-style split comparison slider with real-time file size & % savings calculations.
- Smart Size Redirect — serves the closest matching registered image size instead of a
broken or oversized fallback. - Metadata Orphan Scanner — manual, batched scan for attachment metadata pointing at files
that no longer exist. - Prune Tool — review orphaned files before removing them; nothing is deleted blindly.
- Future Generation Manager & custom image size management.
- Background thumbnail regeneration via WP-Cron, batched to avoid timeouts.
- App-like dashboard with single-site storage stats, export/import configuration.
- Staging-to-Live Production Preset Sync — export complete configurations (core dimensions, size selections, Smart Size Redirect rules, and Pro engines) for seamless local-to-live migration.
Need automated (no-click) background maintenance, AVIF/WebP multi-format delivery, auto-compression, or
multisite/CDN-aware storage analysis? See LC Smart Media Redirect & Cleaner Pro, the licensed
add-on.
This plugin is the direct successor to “Batch Image Cleaner” (v1.9.28 and earlier); Standard
free features and stored settings remain fully compatible.
Current Active Pipeline Status
- Standard lifecycle (v1.9.33, audited August 8, 2026): ✅ Bootstrap order, migration, activation/deactivation, cron ownership, uninstall cleanup, and legacy URL handling were traced end to end. Three defects were fixed: query-string false-positive 410 responses, stale deactivation orphan-scan state, and retained dynamic prune sessions after uninstall.
- Future-upload size generation & Image Size Manager (v1.9.56, audited August 19, 2026): ✅
smrc_get_registered_sizes()updated to read unfiltered registrations directly fromSmrc_Core::get_image_sizes(). Custom registration, override ordering, disabled-size filtering, minimum-longest-side behavior, duplicate-size deduplication, and post-upload metadata were traced end to end. All 26 registered sizes (Core, Theme, WooCommerce, Custom) reliably render on the Image Sizes grid regardless of active upload generation state. - Dashboard configuration controls (v1.9.35, audited August 8, 2026): ✅ Rendered controls, action bindings, nonces/capabilities, option persistence, import/export, and completion feedback were traced end to end. Two UI defects were fixed: numeric settings now acknowledge or safely roll back failures, and the unused scan-subfolder selector was removed.
- Manual thumbnail regeneration (v1.9.36, audited August 8, 2026): ✅ Selected-size persistence, reset/resume/run loop, locks, attachment processing, file/metadata writes, errors, stop, and recovery controls were traced end to end. Two defects were fixed: Stop no longer releases the lock during an active batch, and the live error total includes every batch error.
- Background thumbnail regeneration (v1.9.37, audited August 8, 2026): ✅ AJAX start/status/cancel, cron scheduling, run state, locks, batch processing, completion, stale recovery, and UI feedback were traced end to end. Four concurrency/recovery defects were fixed: duplicate starts and callbacks are blocked, cancellation cannot be overwritten by an in-flight batch, and malformed running state recovers safely.
- Background orphan scanner (v1.9.38, audited August 8, 2026): ✅ Start/status/cancel/clear AJAX, WP-Cron scheduling, persistent offsets/results, filesystem and metadata phases, result caps, cancellation, stale recovery, and UI polling were traced end to end. Four concurrency/recovery defects were fixed: duplicate starts and cron callbacks are blocked, cancellation cannot be overwritten by in-flight work, malformed state recovers to idle, and structured UI failures are handled correctly.
- Cleanup and prune execution (v1.9.39, audited August 8, 2026): ✅ Analysis safety set, prune preparation, transient ownership, batched deletion, per-file path handling, orphan metadata/file deletion, and client completion feedback were traced end to end. Two safety defects were fixed: every batch revalidates its reviewed filesystem scope, and the UI only confirms deletion after a successful server response.
- Rebrand compatibility (v1.9.40, audited August 8, 2026): ✅ Standard bootstrap, class/function identity, shared cron hooks/state, Pro dependency contract, and exported UI metadata were traced end to end. Runtime and exported metadata now use the Smart Media name; retained
bic_*keys are data compatibility identifiers, not executable class/function names. - Active runtime boundary (v1.9.41, audited August 8, 2026): ✅ Configuration import validation now accepts only Smart Media exports. The retired Batch Image Cleaner is not used as a runtime or import dependency; retained
bic_*values remain stored-data compatibility only. - Deletion and regeneration safety (v1.9.42, audited August 8, 2026): ✅ Folder deletion, thumbnail-size deletion, metadata-derived file paths, foreground size selection, and lifecycle cleanup were rechecked. Four defects were fixed: unsafe deletion inputs are rejected, failed deletes retain metadata, folder traversal refuses symlinks/out-of-scope entries, and regeneration processes only active image sizes.
- Third-pass deletion revalidation and state hardening (v1.9.44, audited August 8, 2026): ✅ Orphan deletion (metadata + files), regeneration lock lifecycle, prune lock recovery, custom-size deletion, size-override read paths, configuration import validation, and uninstall coverage of lock options and dynamic scan-accumulator transients.
- Smart Size Redirect (Standard, v1.9.55, audited August 18, 2026): ✅ Dynamic canonical discovery, aspect-ratio/crop-mode compatibility scoring, manual destination overrides, auto-match reset, and frontend
image_downsize/srcset behavior were traced end to end. - Fourth-pass deep audit (Standard + Pro, audited August 10, 2026): ✅ Thumbnail Regeneration, Future Generation & Custom Sizes, Storage Overview & Config Backup, Pro License Engine, Pro WebP Pipeline, Pro Auto-Compression Pipeline, Pro Automated Maintenance, and Pro Multisite & CDN Storage Analysis were thoroughly reviewed end to end. Validated correctness, state transitions, fail-closed safety checks, and edge-cases. Found no regressions or new bugs. The fixes applied in previous passes successfully resolved all prior defects in these pipelines.
Written by Joobi from the project's own listing. See the source page
1.9.81 (November 27, 2026)
- BUG FIX & DATA SAFETY — Config Import Clamp Fix, Settings Persistence & Cache Reset: Fixed
ajax_import_config()clampingsmrc_max_original_widthto a minimum of1200(which silently re-enabled master image downscaling when importing presets where auto-downscale was disabled at0), added explicitreturn;statements after error responses, and calledSmrc_Core::reset_redirect_caches()plusSmrc_Core::reset_folder_scan()on import; updatedAdmin_Interface::handle_save_settings()to persistsmrc_max_original_width,smrc_lcp_preload_enabled, and reset redirect caches on form save; and completeduninstall.phpcleanup to removesmrc_bic_migratedplus.smrc_cache/dotfiles (.htaccess) viaDirectoryIteratorso@rmdir()leaves zero directory residue. - WP-CLI & UI HARDENING — Full-Scope CLI Prune, Regen Progress Accuracy & Safe Import/Export Feedback: Fixed
Smrc_CLI_Command::prune()scanning only the first5,000files instead of paginating the full uploads tree and syncedsmrc_bg_scan_results/ stats caches after deletion; hardenedSmrc_CLI_Command::regen()with--reset, registered size validation, batch-error continuation instead of premature aborts when$processed === 0, and stats invalidation; guardedSmrc_CLI_Command::redirect()against conflicting--enable/--disableflags and flushed redirect caches; preserved original"Download Preset"button labels, enforced 2 MB import file limit, escaped status notices via.text(), syncedSMRC_DATAruntime scan/min-width values after settings updates, styled.smrc-setting-save-status, and prevented#smrc-import-file/ slider horizontal overflow on mobile.
1.9.80 (November 27, 2026)
- PERFORMANCE & DATA INTEGRITY — Regeneration Query Optimization, Vector SVG Skip & WebP/AVIF Companion Cleanup: Disabled
SQL_CALC_FOUND_ROWSand term/meta cache preloading insideSmrc_Core::get_next_batch(); skippedimage/svg+xmlattachments insideSmrc_Core::process_image()so vector uploads never log boguswp_get_image_editor()errors; cleaned up adjacent.webp/.avifcompanion variants viaSmrc_Core::delete_adjacent_image_companions()when non-shared thumbnails are replaced or batch-nuked (delete_all_thumbnails_batch()anddelete_thumbnail_size_files()); added keyset pagination ($last_id/$known_total) todelete_all_thumbnails_batch()andajax_delete_all_thumbnails()to eliminateO(N^2)offset scans; and replaced full-tableORDER BY RAND()scans insideajax_get_image_comparison()with indexed ID-range sampling plus both.webp/.avifand.jpg.webp/.jpg.avifdetection. - BUG FIX & RESPONSIVE UI — Background Regen Guardrails, Adaptive CPU Pacing & Comparison Slider Polish: Rejected starting background regeneration when no registered image sizes are selected (
smrc_bg_regen_start()), clamped background batch sizes (1..500), invalidated folder stats caches on foreground/background completion, and appliedthrottle_delay_msCPU load pacing across bothajax_run_batch()andsmrc_bg_regen_batch(); fixed resume bar width reading pixels instead of percentage (parseFloat(.smrc-progress-text)), escaped modal/banner HTML, synced live error log rows, restored#smrc-bg-regen-cancelicon markup after cancel requests, synced slider width on#smrc-cmp-img-afterimage load, prevented mobiletouchmovescroll hijack during drag, and wrapped#smrc-comparison-modalbanners/footers for<= 600pxscreens.
1.9.79 (November 27, 2026)
- PERFORMANCE & DATA SAFETY — Single-Pass Prune Engine, WebP/AVIF Companion Protection & Keyset Cleanup: Consolidated
smrc_prune_prepare()into a singleRecursiveCallbackFilterIteratorpass that prunes.smrc_cache, symlinks, hidden dot-directories, and optimizer backup folders before descent and evaluates orphan keep-dimension rules inline without double-scanning or buffering full path buckets; skippedsmrc_build_wp_safe_set()when no matches exist and skipped.smrc_cache/transient state writes during dry-run previews (mode=dry); addedsmrc_is_path_in_wp_safe_set()to protect active WebP/AVIF companions alongside registered WP images/thumbnails; convertedsmrc_build_wp_safe_set()andSmrc_Core::delete_thumbnail_size_files()to keyset pagination while cleaning up adjacent WebP/AVIF companions and stale metadata on size deletion; and enabled Folder AnalysisDelete AllinAdmin_Interface::handle_delete_thumbnail_size()for both registered and ghost/legacy thumbnail sizes. - BUG FIX & RESPONSIVE UI — Prune State Token Hardening, Cancellation & Mobile Breakdown UI: Sanitized prune session tokens uniformly via
smrc_prune_sanitize_token(), stopped redundant large transient writes when.smrc_cacheJSON state succeeds, reset folder stats cache whensmrc_prune_delete_batch()finishes deletions, added missingreturn;statements acrosshandle-prune.php/handle-delete.php, removed the unnecessaryis_readable()block withclearstatcache()insmrc_delete_file_and_count(), defined missing.smrc-hiddenCSS so#smrc_prune_cancelstays hidden when idle, honored mid-scan Cancel clicks before starting batch deletion, escaped dynamic JS error/progress HTML in prune notices, displayed skipped counts and synchronized Folder Analysis size lists afterlazyLoadStats()via delegated.smrc-delete-thumbnail-sizeclick handlers, and added mobile wrapping/scroll rules for prune tables and breakdown items.
1.9.78 (November 27, 2026)
- PERFORMANCE & FALSE-POSITIVE FIX — Bulk Orphan Scanner Lookup & WebP/AVIF/-scaled Protection: Replaced per-file N+1
wp_postmetaSQL lookups insideSmrc_Core::get_orphaned_files()(300–600queries/batch ->1bulk query/batch) withSmrc_Core::get_registered_attachment_path_map()andSmrc_Core::is_known_attachment_or_companion(); pruned.smrc_cache, symlinks, and backup folders before directory recursion; scoped orphan file cache keys by subdirectory; and protected active WordPress-scaledunscaled masters (original_image) plus Pro.webp/.avifcompanions from false-positive orphan classification and deletion. - BUG FIX & SECURITY — Persistent Scan Result Sync, Batch Deletion & Styled Notifications: Updated
ajax_delete_orphaned_metadata()andajax_delete_orphaned_files()to purge deleted items fromsmrc_bg_scan_results(preventing deleted items from reappearing on reload) and reset stats caches; chunked large orphan deletions into200-item AJAX batches inadmin-script.jsto avoid PHPmax_input_varstruncation; escaped toastshowNotification()text and added explicit.smrc-notification,.smrc-orphan-controls, and.smrc-orphan-liststyling/scrolling with mobile modal containment; includedpiucounts in background scan banners; guarded#smrc-clear-bg-scanerror states and.smrc-folder-toggleselectors; and addedreturn;afterwp_send_json_error()inhandle-orphan-bg.php.
1.9.77 (November 27, 2026)
- PERFORMANCE & ZERO-WRITE GET — WooCommerce On-the-Fly Thumbnail Regeneration Suppression: Added
Smrc_Core::filter_woocommerce_sizes_to_resize()hooked ontowoocommerce_image_sizes_to_resizeso disabled or Smart-Size-Redirected WooCommerce image sizes never trigger synchronous disk creation orwp_postmetawrites during frontend visitor GET requests (23.55ms / 9 queries / 1 writereduced to0.69ms / 4 queries / 0 writes). - BUG FIX & LCP — Upload Scaling Stat-Cache, Redirect Cache Invalidation & Self-Closing LCP Tags: Cleared PHP stat cache before reading resized filesize and ignored animated GIF/SVG files in
Smrc_Core::scale_original_on_upload(); addedget_queried_object_id()fallback in LCP preload/attribute hooks; preserved self-closing<img ... />syntax inoptimize_lcp_content_image(); and centralizedSmrc_Core::reset_redirect_caches()across redirect/size mutations. - BUG FIX & RESPONSIVE UI — Atomic Inline Dimension Saves, Custom Size Cleanup & Mobile Tables: Replaced dual concurrent dimension POST requests (lost-update race condition) with atomic single-request
ajax_save_size_override(), cleared stalesmrc_size_overridesand pruned option references on custom size edits/deletions, synced UI cards/badges dynamically withescHtml(), wrapped Smart Size Redirect chips and Registered Sizes controls for mobile (<= 600px/<= 480px), and added horizontal scroll containment for#smrc-custom-sizes-table.
1.9.76 (November 27, 2026)
- BUG FIX & RESPONSIVE UI — Cold Overview Auto-Refresh, Formatter & Responsive Shell: Fixed
formatStorageSize(0)returning"0 MB"instead of'0 B'(which preventedlazyLoadStats()from firing on cold transients), addedKBand non-finite guards, marked cold states withdata-stats-cold="1", removed the unmatched stray CSS brace inadmin-style.css, preserved horizontal top-nav labels on<= 960pxviewports even when auto-collapsed, synced#smrc-side-togglearia-expanded, tightened mobile padding at<= 480px, and pointed Quick Setup Step 2 directly to#smart-size-redirect-tab. - PERFORMANCE & DATA INTEGRITY — Stats & Analysis Pipeline Optimization: Eliminated duplicate
smrc_list_upload_subpaths()scanning on dashboard render, pruned.smrc_cache/symlinks/backup directories fromSmrc_Core::get_video_statistics(), checked accumulator expiry before querying inSmrc_Core::scan_stats_batch()while running theCOUNT(*)query once onoffset === 0, excludedimage/svg+xmlfrom non-SVG metadata/size tallies insmrc_media_analysis(), unifiedajax_refresh_stats()authorization, and removed shadowed/incompleteescHtmlinadmin-script.js.
1.9.75 (November 25, 2026)
- PERFORMANCE & ZERO-WRITE GET — Dashboard GET Query Elimination: Added explicit
$persist = falsemode toSmrc_Core::get_processing_stats()so loadingadmin.php?page=smrc-dashboardperforms0option write queries while batch mutations (ajax_run_batch) still persist counters. - BUG FIX — Global Dashboard Nonce Integrity & Thumbnail/Folder Deletion: Rendered
#smrc_nonceglobally indashboard.php(eliminating duplicate IDs in the Quick Setup step form and fixing silent nonce failure when clicking “Delete All” on thumbnail sizes or folders after Quick Setup completes). - BUG FIX — Visual Comparison Slider Modal Overlay & Safe Titles: Added complete fixed-overlay, backdrop, header, close button, and responsive mobile styles for
#smrc-comparison-modalinadmin-style.css, plus decoded plain-text modal titles and structured error extraction inadmin-script.js. - BUG FIX — Background Regen Stale-Lock Reclamation: Added
smrc_regen_acquire_processing_lock(300)to automatically reclaim orphanedsmrc_regeneration_processing_locklocks older than 5 minutes after fatal worker timeouts in bothsmrc_bg_regen_batch()andajax_run_batch(). - BUG FIX & SECURITY — Orphan Scanner Cache Exclusion & Folder Prefix Containment: Excluded
.smrc_cache/, symlinks, and optimizer backup directories fromSmrc_Core::get_orphaned_files(); protected WP-scaledoriginal_imagebackups insidesmrc_build_wp_safe_set(); escaped$wpdb->esc_like()trailing-slash paths incleanup_database_references(); gatedorphan_summaryoutput behinddiscover_orphans; escaped dynamic JS HTML strings in orphan lists and confirmation modals; guarded#anchor smooth-scroll clicks against jQuery selector syntax errors; and prevented stale sidebar.is-activehighlights across Pro tabs. - PHP 8.5 & RESPONSIVE UI — Cast
wp_parse_url()paths to(string)inrender_lcp_preload_tag()andstrip_srcset_originals(), escaped suggestion HTML names insmrc_media_analysis(), and added responsive< 1080px / < 840px / < 600px / < 480pxrules for Quick Setup steps, comparison slider modal, and metrics grid.
1.9.74 (November 1, 2026)
- PERFORMANCE & LATENCY OPTIMIZATION — Smart Size Redirect Target Memoization: Added in-memory request-scoped static memoization to
Smrc_Core::get_canonical_target_sizes()andSmrc_Core::find_best_redirect_target(). Reduces redundant option table lookups and aspect-ratio scoring calculations to 0.001ms across high-density image galleries and archive pages. - ARCHITECTURE — Administrative & AJAX Hook Decoupling: Gated over 25 administrative AJAX action hook registrations (
wp_ajax_smrc_*) behindis_admin() || DOING_AJAX, eliminating unnecessary hook table bloat and memory consumption during public visitor GET requests.
1.9.73 (October 29, 2026)
- PERFORMANCE & SERVER OPTIMIZATION — Eliminating Frontend Table Scans & On-Boot Migrations: Resolved MariaDB CPU bottlenecks by gating legacy postmeta migrations behind a persistent execution flag (
smrc_bic_migrated), ensuring table updates never repeat after initial migration. - ARCHITECTURE — Admin-Scoped Upgrade Execution: Moved
maybe_upgrade()out of frontendplugins_loadedso that schema and version upgrade routines execute exclusively during administrative console requests (admin_init) and plugin activation, eliminating redundant write queries and table locks on public visitor page loads.
1.9.72 (October 19, 2026)
- PERFORMANCE — Memory usage optimizations during high-concurrency image redirect handling and enhanced transient cache cleanup.
1.9.71 (September 2, 2026)
- CACHE LIFECYCLE AUTO-PRUNE — Implemented automated purging of stale
.smrc_cache/review state files (smrc_prune_purge_stale_cache_files()) older than 12 hours upon new review generation, preventing filesystem accumulation from abandoned scans. - ZERO-RESIDUE UNINSTALL COMPLETION — Enhanced
uninstall.phpto clean all lingering cache files and safely remove the.smrc_cache/uploads directory upon plugin deletion.
1.9.70 (September 1, 2026)
- RESEARCH CITATION ALIGNMENT — Updated administrative console Research Journal citation to link directly to the newly published dedicated academic manuscript: “Dynamic Media Dimension Mapping and Filesystem Inode Pruning in High-Concurrency CMS Ecosystems” (Light & Composition University Academic Journal, Vol. 14, Issue 2, Pages 33–64).
1.9.67 (August 29, 2026)
- PERFORMANCE & RELIABILITY — High-Capacity File-Backed Prune State Engine: Upgraded prune list state storage from heavy database transients to fast, protected filesystem caching (
.smrc_cache/) with transient fallback, eliminating MySQL packet exhaustion and timeout bottlenecks when processing 40,000+ files. - ENHANCEMENT — Batch Deletion Lock Auto-Reclaim & 500-Item Chunks: Released locks synchronously before JSON transmission, reduced stale lock threshold to 30s with auto-reclaim, boosted deletion batch size to 500 items, and added automatic 409-lock contention retries in admin JavaScript.
- OPTIMIZATION — Lean Prepare Payload: Trimmed
orphan_summarypreview arrays to avoid large JSON transfers during orphan discovery.
1.9.66 (August 26, 2026)
- REBRANDING & URL SYNC — Updated
Plugin URItohttps://www.lightandcomposition.com/dev/lc-smart-media-redirect-cleaner/across plugin headers, Dev Lab catalog, and metadata mappings.
1.9.65 (August 26, 2026)
- REVIEW COMPLIANCE — Directory slug alignment to
lc-smart-media-redirect-cleaner, full text domain unification, unslashed and sanitized nonce verification, and template late-escaping audit.
1.9.64 (August 25, 2026)
- AUDIT — 17-Pipeline Deep End-to-End Audit: Full code and security verification across all 17 pipelines including SSR routing, orphan cleanup, lock lifecycle, master downscaler, and LCP booster.
- COMPLIANCE — Zero-Residue Lifecycle Cleanup: Added missing options (
smrc_max_original_width,smrc_lcp_preload_enabled) touninstall.phpandactivate()/maybe_upgrade()defaults. - HARDENING — Form Action & Superglobal Sanitization: Added strict
sanitize_key()andwp_unslash()sanitization across admin form actions and AJAX request parameters. - TEST SUITE — Verified 100% test pass rate across 225 automated unit tests with 765 assertions.
1.9.63 (August 25, 2026)
- REFACTOR — WordPress.org Directory Rebranding: Renamed plugin to
LC Smart Media Redirect & Cleaner(slug:smart-media-redirect-cleaner) to ensure distinctiveness and eliminate generic/trademark collisions. - SECURITY — JSON Import Deep Sanitization: Added recursive
sanitize_json_payload()sanitiz
Follow this listing's changes (Atom feed)