Selective Thumbnail Regenerator

描述

The Selective Thumbnail Regenerator plugin provides a powerful and user-friendly way to regenerate image thumbnails for WordPress media libraries. Unlike other thumbnail regeneration plugins that blindly process the entire library, this plugin gives you precise control: choose a specific year, month, and even a title keyword to target exactly the images you need.

Key Features

  • Date & Title Filters – Choose a specific year, month, or search by title to target only the images you need.
  • Month Status Calendar – A visual 4×3 calendar grid appears when you select a year. Months that have been regenerated are highlighted in green with a checkmark. Clicking a month badge automatically selects it.
  • Regeneration History Tracking – Completed months are stored in the database and persist across sessions. A “Reset History” button clears all records when needed.
  • Thumbnail Size Selection – Choose specific registered thumbnail sizes to regenerate instead of all sizes.
  • Configurable Batch Size – Set how many images are processed per AJAX request (1-20).
  • Throttle Delay Control – Set a cooldown pause between batches (0-2000 ms) to reduce server load.
  • Dry Run Mode – Preview which images would be processed without writing any changes to disk.
  • Automatic Batch Failure Recovery – If a batch crashes, the plugin retries each image individually, isolates the bad one, logs it, and continues with the rest.
  • Failed Images Log – Detailed table of all failed images including ID, title, and exact failure reason.
  • Orphaned File Cleanup – Old thumbnail files are deleted from disk before new ones are generated.
  • Live Terminal Activity Log – Real-time monospace console with timestamped status messages.
  • Visual Completion Metrics – Five-card summary board: Processed, Successful, Failed, Skipped, Duration.
  • Cancel Support – Stop the regeneration at any time with a graceful shutdown.
  • Performance Optimized – Direct indexed SQL query for year selector loading.

Usage

  1. Navigate to Tools > Selective Thumbnail Regenerator.
  2. Select a year from the dropdown. A Month Status Calendar will appear showing which months have already been regenerated.
  3. Optionally select a month – via the dropdown or by clicking a month badge on the calendar.
  4. Optionally enter a title keyword to filter images by name.
  5. Adjust batch size and throttle delay in the Performance Configuration card.
  6. Enable Dry Run Mode to preview results without making changes.
  7. Click “Scan Matching Images” to count how many images match your filters.
  8. Click “Start Regeneration” to begin. Watch the live terminal log for real-time updates.
  9. Review the Job Completion Report and Failed Images Log after the process ends.

Troubleshooting

“No images found for the selected period”

There are no image attachments uploaded during the selected year/month. Try a different time period.

The process is slow

Reduce the throttle delay or increase the batch size if your server can handle more load. Alternatively, increase the delay and reduce batch size if you are getting timeouts.

A batch keeps failing

Enable Dry Run Mode first to verify image accessibility. If specific images crash the server, they will appear in the Failed Images Log after regeneration completes.

安装

  1. Download the plugin ZIP file.
  2. Log in to your WordPress admin panel.
  3. Go to Plugins > Add New > Upload Plugin.
  4. Upload the ZIP file and click “Install Now”.
  5. Activate the plugin through the “Plugins” menu in WordPress.

常见问题

Why would I need to regenerate thumbnails?

You might need to regenerate thumbnails if:
* You’ve changed your theme and it uses different thumbnail sizes
* You’ve modified thumbnail sizes in WordPress settings
* You’ve installed a plugin that adds new thumbnail sizes
* Your thumbnails are corrupted or missing

Will this plugin delete my original images?

No. The plugin only regenerates thumbnail versions. Your original uploaded images are never touched.

What does “orphaned file cleanup” mean?

When thumbnail dimensions change and you regenerate, old thumbnail files remain on disk. This plugin automatically deletes those stale files before writing new ones, keeping your uploads folder clean.

What happens if an image file is missing from the server?

The plugin detects the missing file, marks it as failed in the log, and moves on. The entire regeneration process never stops because of a single missing file.

What happens if a server error occurs mid-batch?

The plugin automatically enters single-retry mode: it re-processes each image in the failed batch individually. The image causing the crash is identified, logged in the Failed Images report, and skipped so the rest complete successfully.

How does Dry Run Mode work?

When Dry Run is enabled, the plugin queries all matching images and logs which ones would be processed – without actually regenerating thumbnails or writing to disk. History is not updated during dry runs.

What is the Month Status Calendar?

It is a 4×3 grid of month badges displayed beneath the date filter. Once a month is fully regenerated for a given year, its badge turns green with a checkmark. This state is saved in the database and persists across sessions. You can reset history at any time.

Can I cancel the process?

Yes. Click the “Cancel Process” button. The current batch completes first, then the process stops and shows a partial summary.

What happens if I close the browser during regeneration?

The process stops. Already regenerated months will still show as done in the calendar.

评价

此插件暂无评价。

贡献者及开发者

「Selective Thumbnail Regenerator」是开源软件。 以下人员对此插件做出了贡献。

贡献者

更新日志

1.0.4

  • Critical Fix: Fixed fatal AJAX error by conditionally loading wp-admin/includes/image.php before calling wp_generate_attachment_metadata().
  • Performance Fix: Replaced PHP loop-based year extraction with a single fast $wpdb SQL query.
  • Bug Fix: Allow thumbnail generation for attachments with missing or corrupt database metadata (empty-array fallback instead of error).
  • Cleanup: Implemented physical deletion of orphaned thumbnail files from disk before regeneration.
  • Feature: Month Status Calendar – visual 4×3 grid showing regenerated months per year, persisted in the database with Reset History support.
  • Feature: Regeneration History Tracking stored in wp_options, persists across sessions.
  • Feature: Image title search filter for targeting images by name.
  • Feature: Dry Run Mode – preview processing without writing to disk.
  • Feature: Configurable Batch Size slider (1-20 images per request).
  • Feature: Configurable Throttle Delay slider (0-2000 ms cooldown between batches).
  • Feature: Automatic batch failure recovery – retries each image individually when a batch crashes, then continues.
  • Feature: Failed Images Log – detailed table showing ID, title, and exact error for every failed image.
  • Feature: Cache busting on “Scan Matching Images” to always return fresh counts.
  • Redesign: Full UI overhaul – Inter font, card-based responsive layout, custom progress bar, live terminal console, metrics board.

1.0.3

  • Feature: Thumbnail size selection – choose which specific sizes to regenerate
  • Feature: Cancel button – stop the regeneration process at any time
  • Feature: Batch processing – process multiple images per AJAX request for faster regeneration
  • Feature: Summary report – view success/failure counts and elapsed time after completion
  • Improved: Updated FAQ with new feature documentation

1.0.2

  • Security: Added capability checks to AJAX handlers for improved security
  • Removed unnecessary plugin assets
  • Removed empty languages folder and Domain Path header
  • Code structure improvements

1.0.1

  • Security: Added ABSPATH protection to prevent direct file access
  • Compatibility: Updated “Tested up to” value to WordPress 6.8
  • Code Standards: Changed all prefixes from ‘str’ to ‘strgrtr’ for uniqueness
  • Updated main class name to STRGRTR_Thumbnail_Regenerator
  • Fixed contributor username in readme
  • Updated all JS/CSS/HTML elements to use consistent prefixes

1.0.0

  • Initial release