src/Image.php
public function tag(SizeRange $range, Size $defaultSize, array $attributes = []): string
    {
        $attributes = new Map($attributes);
        $attributes['alt'] = $attributes['alt'] ?? '';
        $attributes['sizes'] = $attributes['sizes'] ?? '100vw';
        $attributes['src'] = $this->source($defaultSize);
        $attributes['srcset'] = $this->sourceSet($range);

        $attributeString = $attributes
            ->ksorted()
            ->map(function ($key, $value) {
                return "$key='$value'";
            })
            ->values()
            ->join(' ');

        return "<img $attributeString>";
    }
public function tag(SizeRange $range, Size $defaultSize, array $attributes = []): string
    {
        $attributes = new Map($attributes);
        $attributes['alt'] = $attributes['alt'] ?? '';
        $attributes['sizes'] = $attributes['sizes'] ?? '100vw';
        $attributes['src'] = $this->source($defaultSize);
        $attributes['srcset'] = $this->sourceSet($range);

        $attributeString = $attributes
            ->ksorted()
            ->map(function ($key, $value) {
                return "$key='$value'";
            })
            ->values()
            ->join(' ');

        return "<img $attributeString>";
    }
public function tag ( SizeRange $ range , Size $ defaultSize , array $ attributes = [ ] ) : string { $ attributes = new Map ( $ attributes ) ; $ attributes [ 'alt' ] = $ attributes [ 'alt' ] ?? '' ; $ attributes [ 'sizes' ] = $ attributes [ 'sizes' ] ?? '100vw' ; $ attributes [ 'src' ] = $ this -> source ( $ defaultSize ) ; $ attributes [ 'srcset' ] = $ this -> sourceSet ( $ range ) ; $ attributeString = $ attributes -> ksorted ( ) -> map ( function ( $ key , $ value ) { return "$key='$value'" ; } ) -> values ( ) -> join ( ' ' ) ; return "<img $attributeString>" ; }
Return a responsive HTML `img` tag for the image.

@param string[] $attributes list of attributes to add to the `img` tag
Return a responsive HTML img tag for the image .