Skip to content

[00] Subset Sizes, User guide

WP Offload Media

Last updated

How Subset Sizes makes on-demand sizes for images WP Offload Media has moved to a bucket, what happens when it can't, and other offload plugins.

Subset Sizes works with WP Offload Media, and with other plugins that move your media to cloud storage. A size that doesn’t exist yet is made on your server from the original, then handed to the offload plugin to upload like any other size. You don’t need to change a setting on either plugin.

What works

Subset Sizes treats an image as offloaded when WP Offload Media is set up with a bucket and says it serves that image from the bucket. For those images:

  • Sizes that don’t exist yet point at your site. WP Offload Media rewrites image URLs to your bucket, where a missing size would return a 404 that never reaches WordPress. Subset Sizes keeps the URL of a size that hasn’t been made on your own uploads folder, so the request reaches the plugin.
  • The original is copied back to make the size. Subset Sizes turns on WP Offload Media’s copy-back for the length of the resize, so the original is downloaded from the bucket if it’s no longer on your server.
  • The new size is uploaded. Saving the size into the image’s metadata triggers WP Offload Media’s own upload, the same step it runs for sizes WordPress makes at upload.
  • Sizes already in the bucket aren’t made again. A request for one gets a temporary redirect (302) to its bucket URL, cached for an hour.

With Lazy sizes on, most of an image’s sizes are missing until a page asks for them. WP Offload Media normally waits for every registered size before it uploads an image. Subset Sizes tells it, while the new size is saved, that no more sizes are coming, so the upload isn’t held back.

What needs a setting

Nothing on the Subset Sizes side. On WP Offload Media, the settings in its documentation (opens in a new tab) work as they do without Subset Sizes:

  • With Remove Local Media on, WP Offload Media deletes the local copy after the upload, and each new size is downloaded from the bucket once to make it.
  • With it off, the original stays on your server and nothing is downloaded.

On nginx, the request for a missing size has to reach WordPress. That’s the same rule every Subset Sizes site needs, in Getting started.

Other offload plugins

Subset Sizes has no dedicated code for other offload plugins, but handles them the same way. It treats an image as offloaded when its file is missing from your server and its URL points somewhere other than your uploads folder. To make a size, it downloads the original from that URL, with a 30-second timeout, and deletes the download afterwards. The offload plugin picks up the new size if it uploads sizes when an image’s metadata is saved, which is how WordPress itself reports new sizes.

Known limits

  • The first request for a size runs on your server. It downloads the original when it isn’t local, so the first visitor to see that size waits for the download as well as the resize.
  • If the original can’t be downloaded, visitors get the full image. The request redirects to the full-size image in the bucket instead of returning an error, and Tools → Site Health shows “Some image sizes couldn’t be created for offloaded media” for a week after the last failure. Check that the offload plugin can still reach its bucket.
  • Sizes are found by the name WordPress records. A size that exists in the bucket but isn’t in the image’s metadata is made again.