Issue Feature Closed

#102215ViewHelper to generate srcset for responsive images

Simon Praetorius 10/20/23, 15:01 updated 03/31/26, 09:00

Description

After some initial HTML standards confusion, srcset/sizes/picture are well-established in the web and are used in a lot of TYPO3 projects nowadays. While there are a few 3rd party extensions out there (I built one of them), I really think that this should be part of the core along the existing ImageViewHelper.

As a first step, I would like to add a new SrcsetViewHelper, which only renders the attribute without any tag. Thus, it is very flexible and can be used:

  • with custom img tags not using the ImageViewHelper
  • with the various options the <picture> tag offers
  • with <link rel="preload" as="image" imagesrcset="..." /> to preload responsive images
  • with the existing ImageViewHelper and additionalAttributes (however I think that this should be integrated in a next step)

I try to keep the ViewHelper API as simple as possible to prevent complexity similar to ImageViewHelper. I would also like to extract the core functionality to a utility class, so that it becomes available to other parts of the core as well as 3rd party extensions.

Reviews 1