Image optimization is a premium feature that allows optimizing your images instantly without using your server resources.
When this feature is enabled, the original image addresses will be replaced with our image optimization service (img.poweredcache.net). This service will perform on-the-fly image optimization, resizing, and conversion to AVIF or WebP formats, depending on what the client’s browser supports.
How to exclude Images from Image Optimizer?
You can use the powered_cache_image_optimizer_skip_image filter to control the behavior programmatically. For instance, the following snippet will exclude .svg images from being served by our image optimizer:
function exclude_svg_images_from_optimization( $skip, $src, $tag ) {
// Check if the image URL ends with .svg
if ( strpos( $src, '.svg' ) !== false ) {
$skip = true;
}
return $skip;
}
add_filter( 'powered_cache_image_optimizer_skip_image', 'exclude_svg_images_from_optimization', 10, 3 );
How to disable Image Optimizer via Filter?
You can programmatically disable the image optimizer by using the powered_cache_image_optimizer_disable filter.
eg:
add_filter( 'powered_cache_image_optimizer_disable', function ( $disable ) {
if ( is_page( 'your-page-slug' ) ) {
$disable = true;
}
return $disable;
} );
Limitations
- Partial cache invalidations occur when you purge all caches or specifically clear the Image Optimizer’s cache. While this action clears the cached content on the CDN, some images may remain cached on our image optimization servers for performance reasons. If you need to refresh an image, simply upload it with a different name.
- You can only purge the Image Optimizer’s cache when using it in a non-multisite environment.
- We only fetch, resize, and serve GIF, PNG, JPG, WebP, AVIF, BMP and SVG images from servers that listen on port 80 for HTTP and port 443 for HTTPS.
- It’s not possible to choose or limit where in the world your images will be served from. Our servers will load your image depending on a variety of factors, including the visitor’s location.
- Image Optimizer service is only allowed to be used by sites that have an active license/subscription. Any abuse or violation of the Terms of Service could result in the suspension of your site.