Note: Image optimization is a paid feature available only for users with an active Sail Premium subscription.
After enabling Sail premium for your WordPress application, the image optimization service will be configured automatically. This will cause requests for images to be proxied to Sail's optimization service which will:
Sail Premium will also enable a small plugin on your WordPress site which adds resize parameters to images. This enables users to change themes, update image sizes, etc., without having to regenerate thumbnails (and other image sizes).
It will also constrain content images to the content width defined by the theme. If you wish to disable this behavior, use a WordPress filter:
add_filter( 'sail_resize_images', '__return_false' );
Note that Sail does not replace your original images with compressed or optimized images, it is simply a proxy.
For existing sites with a lot of images you might notice some lag when displaying the optimized images for the first time after enabling premium. This lag is temporary due to the large queue of images that need processing coming from your site.
Resized and optimized images will be cached on your server indefinitely for
performance reasons. If you wish to clear this cache, empty the
directory on your server.
Converting to WebP will be done only for requests that explicitly state their support for the image/webp MIME type through the Accept header. This means that modern browsers will almost always receive a WebP image instead of JPG/PNG ones.
The following image types are supported by Sail's image optimization proxy:
If you have any questions about image optimization with Sail, feel free to get in touch.