High-level feature
Adds the ability to regenerate existing images in core via a user interface.
Overview
This is an overview of related issues. This may not necessarily be comprehensive, for a full list see all issues related to the "Regenerate Existing Images" module here. When opening a new issue related to this feature, make sure to add the [Module] Regenerate Existing Images label.
Phase 1
Phase 1.1
Phase 1.2
Phase 1.3
Phase 1.4
Phase 1.5
Phase 1.6
Phase 1.7
Additional Details
Module proposal: #445
Purpose
The purpose of this module is to provide administrators with a user interface to regenerate images in core without the need for an additional plugin or use of WP-CLI. This makes the feature more accessible to non-technical users.
As the regeneration of images is time consuming, and cannot be performed in a single request or a few AJAX requests, a new background process infrastructure will be created to handle long running tasks.
Rationale
As part of an effort to improve performance within WordPress, the Performance team has introduced WebP images into core. Providing administrators with a means to regenerate their existing images to create WebP versions will improve performance across their site.
Additionally, when administrators install and activate a new theme, existing images may be served at incorrect sizes, which can have a negative impact on performance. By providing an accessible way to regenerate these images, we can ensure that the correct sizes are served on the frontend and improve the site's performance.
Scope
The module can be seen as 2 parts: 1) the background processing infrastructure, and 2) the admin user interface and job to regenerate images.
The background processing infrastructure will be created to handle long-running, time-intensive tasks. It will be decoupled from the logic to regenerate existing images and can be used for any types of jobs.
The Regenerate Images job will utilize the background processing infrastructure to handle the regeneration of images. This will work alongside with a new admin settings screen to trigger the regeneration of images.
Additionally, other entry points across WP Admin can be created to trigger the regeneration of one or more images more contextually: for example, a bulk action in the Media Library or Gutenberg controls to regenerate all images in a post.
As this is a large feature, it will need to be broken down into multiple phases that build from one another. Each phase of the feature will first be introduced into the Performance Lab plugin and released before the next phase for testing.
To help with the release a separate branch will be created to act as a feature trunk branch. This branch will be used to develop and review the feature in parts. Once the feature is complete the feature trunk branch will then be merged into the Performance Lab plugin.
The first phases will include creating the Background Processing Infrastructure, the Regenerate Images Job, and Admin settings screen. Each phase will first be released to the Performance Lab plugin for testing and ultimately later merged into WordPress core.
A breakdown of the phases can be seen below:
Phase 1: Implement backend infrastructure
- Implement the backend infrastructure to handle resource/time intensive tasks
- Implement the image regeneration process on top of the new infrastructure
- Create a dedicated admin page to initiate a global image regeneration
Phase 2a: Provide alternative image generation types
- Extend the admin page to offer controls to define a subset of image sizes to regenerate, such as images uploaded between 2 dates.
- Extend the WordPress media library to provide a bulk action where administrators can select specific images to regenerate
- Extend the WordPress admin post list screen to provide a bulk action where administrators can select specific posts where it’s images will be regenerated
Phase 2b: Gutenberg Controls
- Provide a Gutenberg Document Panel to allow administrators to regenerate all images for the edited post
- Provide a Gutenberg control for the featured image to regenerate the post thumbnail
- Provide a Gutenberg panel for blocks (such as the Image block) where administrators can resize the blocks currently displayed image