# Selective Thumbnail Regenerator

A WordPress plugin that allows users to regenerate thumbnails for media files uploaded in specific months and years.

## Description

The Selective Thumbnail Regenerator plugin provides a convenient way to regenerate image thumbnails for WordPress media libraries. Unlike other thumbnail regeneration plugins that process the entire library, this plugin allows you to selectively regenerate thumbnails for images uploaded during a specific year and month.

### Key Features

- **Date-based Selection**: Choose a specific year and month to limit which thumbnails are regenerated
- **Thumbnail Size Selection**: Choose which specific thumbnail sizes to regenerate instead of all sizes
- **Batch Processing**: Process multiple images per request for faster regeneration
- **Cancel Support**: Stop the regeneration process at any time with the cancel button
- **Summary Report**: View a detailed summary after regeneration with success/failure counts and elapsed time
- **Progress Tracking**: Visual progress bar shows the status of the regeneration process
- **User-friendly Interface**: Simple dropdown menu interface for date selection
- **Resource-friendly**: Built-in delay between batches to prevent server overload
- **Real-time Updates**: Status messages show the current progress and any errors

## Installation

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.

## Usage

1. In your WordPress admin panel, navigate to Tools > Selective Thumbnail Regenerator.
2. Select the year and optionally the month for which you want to regenerate thumbnails.
3. Optionally select specific thumbnail sizes to regenerate (leave all unchecked for all sizes).
4. Click "Check Number of Images" to see how many images will be processed.
5. Click "Regenerate Thumbnails" to start the regeneration process.
6. Use the "Cancel" button if you need to stop mid-process.
7. Review the summary report when the process completes.

## Requirements

- WordPress 5.0 or higher
- PHP 7.0 or higher

## Frequently Asked Questions

### 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 the 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 any of my original images?

No, the plugin only regenerates thumbnail versions of your existing images. The original uploaded images remain untouched.

### How long does the regeneration process take?

The time depends on several factors, including:
- The number of images in the selected period
- Your server's processing power
- The size of your original images
- The number of thumbnail sizes defined in your WordPress installation

The plugin processes images in batches (5 at a time by default) with a short delay between batches to balance speed and server load.

### Can I cancel the regeneration process?

Yes, click the "Cancel" button that appears during regeneration. The process will stop after the current batch finishes, and you'll see a summary of what was completed.

### What happens if I close the browser during regeneration?

The regeneration process will stop if you navigate away from the page or close your browser. You'll need to restart the process when you return.

### Can I regenerate only specific thumbnail sizes?

Yes, the plugin displays all registered thumbnail sizes with checkboxes. Select only the sizes you need, or leave all unchecked to regenerate all sizes.

## Troubleshooting

### Error: "No images found for the selected period"

This means there are no images in your media library that were uploaded during the selected year and month. Try selecting a different time period.

### The regeneration process is slow

This is normal behavior. The plugin deliberately adds a 1-second delay between processing each image to prevent server overload. This might make the process seem slow, but it ensures stability.

### The process stops with an error message

If you encounter an error during regeneration, check your server's PHP error logs for more details. Common issues include memory limits, timeout settings, or file permission problems.

## License

This plugin is licensed under the GPL v2 or later.

## Credits

Developed as a custom WordPress plugin for thumbnail regeneration by Redberet - https://rberet.com - Adi Glibanovic.