Automattic / regenerate-thumbnails

WordPress plugin for regenerating thumbnails of uploaded images. Over 1 million active users and counting.
https://alex.blog/wordpress-plugins/regenerate-thumbnails/
GNU General Public License v2.0
133 stars 54 forks source link
javascript php vuejs wordpress wordpress-plugin

Regenerate Thumbnails

Travis CI Build Status WordPress Plugin Version WordPress Tested WordPress Plugin Downloads WordPress Plugin Rating

Regenerate Thumbnails is a WordPress plugin that will regenerate all thumbnail sizes for one or more images that have been uploaded to your WordPress Media Library.

This is useful for situations such as:

It also offers the ability to delete old, unused thumbnails as well as update the content of posts to use the new thumbnail sizes.

Alternatives

WP-CLI

If you have command line access to your server, I highly recommend using WP-CLI instead of this plugin as it's faster (no HTTP requests overhead) and can be run inside of a screen for those with many thumbnails. For details, see the documentation of its media regenerate command.

Jetpack's Site Accelerator Module

Jetpack is a plugin by Automattic, makers of WordPress.com. It gives your self-hosted WordPress site some of the functionality that is available to WordPress.com-hosted sites.

The Site Accelerator Module makes the images on your site be served from WordPress.com's global content delivery network (CDN) which should speed up the loading of images. Importantly though it can create thumbnails on the fly which means you'll never need to use this plugin.

Building The Plugin

The latest release can be downloaded from WordPress.org, but if you wish to build your own copy, here's how:

  1. Make sure you have Node.js installed.

  2. Clone this repository inside your plugins directory:

    $ git clone https://github.com/automattic/regenerate-thumbnails.git
    $ cd regenerate-thumbnails
  3. Install yarn package manager. It's like npm but better.

  4. Install the other dependencies:

    yarn
  5. Build the plugin's JavaScript file in production mode:

    yarn build-production
  6. Activate the plugin and visit Tools → Regenerate Thumbnails.

Development Mode

If you're looking to make modifications to this plugin's Vue.js code, run the following command:

yarn watch

This will do the following things:

Alternatively if you just want to manually build a development copy of the Javascript, then run this command:

yarn build

Unit Tests

To run the PHPUnit unit tests, first run the install-wp-tests.sh script from the bin directory. Then simply run phpunit from the plugin's root directory.