Is there a way to automatically add width and height attributes to an image tag based on its source file’s dimensions? I’m trying to reduce the cumulative layout shift caused by using responsive CSS for images.
I could probably use a file’s dimensions when outputting a regular image in my php templates, but what about when an image block is used on the front end or if I use a responsive image tag using
When using the responsive Concrete method in my templates in v8, I am able to set a width and height this way:
$tag = $img->getTag(); $tag->width = <some number>; $tag->height = <some number>;
But doing so only results in setting these attributes on the parent picture element and not the image tag within and therefore does not address the issue.
Any ideas on what I can do?