The “Image elements do not have explicit width and height” warning might appear in the Google PSI report when you are testing your website:
NitroPack does not add explicit width and height to images to avoid compatibility issues with different galleries and carousels.
What it does instead is to set a placeholder SVG with the same size as the original image so that galleries and carousels can be initialized correctly and the containers can be resized as the original images.
Our “Size images preemptively” feature assist by ensuring all images get explicit width and height before they are loaded with the above solution, but our current method is not detected by Google PSI.
The feature is enabled by default in our Medium, Strong, or Ludicrous optimization modes. In case you’re using the Custom mode, you can enable it by going to https://nitropack.io/user/settings > Images > Automatic Image Lazy Loading.
When making changes in the Dashboard, don’t forget to purge the cache afterward so changes can take place.
You can do so under the Cache Status tab in your NitroPack dashboard: