Have the default "Image" module add height and width attributes to its HTML

Problem: the default “Image” module does not add height and width attributes to its HTML when used with the option “Size: Automatically adjust”.

Why it’s benefitical:

  • The automatic image resizing by HubSpot requires the height and width attributes to img element (read here: Automatic image resizing on HubSpot content). The resizing enables showing correct image size on each device screen size, thus serving more optimized images for smaller screens.
  • There can be less layout shift when the sizes are mentioned.
  • Better for SEO as Lighthouse sees the width and height attribute as a small factor for speed score.

Who is this for? This does not affect the content editors or developers, but it does affect the visitors visiting a website that has been created with HubSpot. With the optimized images, the site will load faster and save them bandwith.

Discussion about this issue: https://community.hubspot.com/t5/CMS-Development/The-default-quot-Image-quot-module-doesn-t-add-height-and-width/m-p/643537

Hello,

It would be great to have it indeed, it’s a must-have in terms of website performance (increases Pagespeed score by reducing CLS).

Thank you.