private boolean addResponsiveImageMediaFormats ( MediaArgs mediaArgs ) { Map < String , MediaFormat > additionalMediaFormats = new LinkedHashMap <> ( ) ; // check if additional on-the-fly generated media formats needs to be added for responsive image handling if ( ! resolveForImageSizes ( mediaArgs , additionalMediaFormats ) ) { return false ; } if ( ! resolveForResponsivePictureSources ( mediaArgs , additionalMediaFormats ) ) { return false ; } // if additional media formats where found add them to the media format list in media args if ( ! additionalMediaFormats . isEmpty ( ) ) { List < MediaFormat > allMediaFormats = new ArrayList <> ( ) ; if ( mediaArgs . getMediaFormats ( ) != null ) { allMediaFormats . addAll ( Arrays . asList ( mediaArgs . getMediaFormats ( ) ) ) ; } allMediaFormats . addAll ( additionalMediaFormats . values ( ) ) ; mediaArgs . mediaFormats ( allMediaFormats . toArray ( new MediaFormat [ allMediaFormats . size ( ) ] ) ) ; } return true ; }
Add on - the - fly generated media formats if required for responsive image handling via image sizes or picture sources .