src/Controller/Api/MediaController.php
public function getMediumFormatsAction($id)
    {
        $media = $this->getMedium($id);

        $formats = [MediaProviderInterface::FORMAT_REFERENCE];
        $formats = array_merge($formats, array_keys($this->mediaPool->getFormatNamesByContext($media->getContext())));

        $provider = $this->mediaPool->getProvider($media->getProviderName());

        $properties = [];
        foreach ($formats as $format) {
            $properties[$format]['url'] = $provider->generatePublicUrl($media, $format);
            $properties[$format]['properties'] = $provider->getHelperProperties($media, $format);
        }

        return $properties;
    }
public function getMediumFormatsAction($id)
    {
        $media = $this->getMedium($id);

        $formats = [MediaProviderInterface::FORMAT_REFERENCE];
        $formats = array_merge($formats, array_keys($this->mediaPool->getFormatNamesByContext($media->getContext())));

        $provider = $this->mediaPool->getProvider($media->getProviderName());

        $properties = [];
        foreach ($formats as $format) {
            $properties[$format]['url'] = $provider->generatePublicUrl($media, $format);
            $properties[$format]['properties'] = $provider->getHelperProperties($media, $format);
        }

        return $properties;
    }
public function getMediumFormatsAction ( $ id ) { $ media = $ this -> getMedium ( $ id ) ; $ formats = [ MediaProviderInterface :: FORMAT_REFERENCE ] ; $ formats = array_merge ( $ formats , array_keys ( $ this -> mediaPool -> getFormatNamesByContext ( $ media -> getContext ( ) ) ) ) ; $ provider = $ this -> mediaPool -> getProvider ( $ media -> getProviderName ( ) ) ; $ properties = [ ] ; foreach ( $ formats as $ format ) { $ properties [ $ format ] [ 'url' ] = $ provider -> generatePublicUrl ( $ media , $ format ) ; $ properties [ $ format ] [ 'properties' ] = $ provider -> getHelperProperties ( $ media , $ format ) ; } return $ properties ; }
Returns media urls for each format.

@ApiDoc(
requirements={
{"name"="id", "dataType"="integer", "requirement"="\d+", "description"="media id"}
},
statusCodes={
200="Returned when successful",
404="Returned when media is not found"
}
)

@param $id

@return array
Returns media urls for each format .