Responsive images that support more than one media format

Description

The MediaFormatResolver takes only the first media format of the MediaArgs into account when it comes to generating additional media formats for the responsive widths - see MediaFormatResolver.java#L171-L176
This forces the responsive source set to be of the first media format, even if the original rendition has another supported media format. Hence you cannot have a responsive image that supports multiple media formats.

Example Usecase:
An image component supports 16:9, 2:3 and 1:1 media formats. If you set the image sizes 100, 200 and 300, the media handler only renders 16:9 responsive images. Now if you declare all responsive widths as optional, you can get also 2:3 and 1:1 images but they are not responsive. Only 16:9 images are rendered with a source set.
Expected behavior: all valid media formats must be rendered as responsive images.

Improvement:
MediaFormatResolver should generate the additional media formats for all available media formats in the MediaArgs.

Any objection or thoughts on this? Otherwise I will prepare a PR

Assignee

Stefan Seifert

Reporter

Masoud Rozati

Labels

None

Components

Fix versions

Priority

Major
Configure