Does not work with srcset
-
The image code generated by WordPress contains a srcset, listing all the different sizes of images available for that image so the browser can pick the best size.
Unfortunately these other sizes are not rewritten by this plugin, so do not exist. When the browser chooses one, the file does not exist, and no image is shown.
Here is an example of the code output by WordPress (using image size “medium” in this particular case)
As you can see, the actual src attribute has been rewritten to point at the cache, but none of the srcset images have.
<img width="600" height="600" src="//localhost:3000/wp-content/cache/thumbnails/./image-600x600.png" class="attachment-medium size-medium" alt="" loading="lazy" srcset="//localhost:3000/wp-content/uploads/image-600x600.png 600w, //localhost:3000/wp-content/uploads/image-150x150.png 150w, //localhost:3000/wp-content/uploads/image-100x100.png 100w, //localhost:3000/wp-content/uploads/image-300x300.png 300w, //localhost:3000/wp-content/uploads/image-64x64.png 64w, //localhost:3000/wp-content/uploads/image-768x768.png 768w, //localhost:3000/wp-content/uploads/image-640x640.png 640w, //localhost:3000/wp-content/uploads/image-400x400.png 400w, //localhost:3000/wp-content/uploads/image-800x800.png 800w, //localhost:3000/wp-content/uploads/image-560x560.png 560w, //localhost:3000/wp-content/uploads/image-367x367.png 367w, //localhost:3000/wp-content/uploads/image-85x85.png 85w, //localhost:3000/wp-content/uploads/image-32x32.png 32w, //localhost:3000/wp-content/uploads/image.png 1000w" sizes="(max-width: 600px) 100vw, 600px">
- The topic ‘Does not work with srcset’ is closed to new replies.