Why aren't all the images on a page optimized by Autoptimize?

When the image optimization service provided by Autoptimize is on (see Settings > Autoptimize > Images), Autoptimize will look for PNG, GIF and JPG files in "img" tags, "picture" tags or as background images in the "style" attribute of a "div". For example:

<img src="https://example.com/myimage.jpg">
<div style="background-image:myimagejpg;">

Autoptimize will also look for images in CSS files that are loaded from your own domain, and change the "src" value (the source) to the image served by ShortPixel CDN.

If images are not served by our CDN, then:

  • Your images are loaded from other domains
  • Your images are loaded with an AJAX call
  • Your images are defined in custom attributes, like <div data-img="image.jpg">

To solve this, you can try using our plugin ShortPixel Adaptive Images.

Still need help? Contact Us Contact Us