src/Sulu/Bundle/MediaBundle/Search/Subscriber/MediaSearchSubscriber.php
private function getImageUrl($media, $locale)
    {
        $mediaApi = new Media($media, $locale);
        $this->mediaManager->addFormatsAndUrl($mediaApi);
        $formats = $mediaApi->getThumbnails();

        if (!isset($formats[$this->searchImageFormat])) {
            $this->logger->warning(sprintf(
                'Media with ID "%s" does not have thumbnail format "%s". This thumbnail would be used by the search results.',
                $media->getId(),
                $this->searchImageFormat
            ));

            return;
        }

        return $formats[$this->searchImageFormat];
    }
private function getImageUrl($media, $locale)
    {
        $mediaApi = new Media($media, $locale);
        $this->mediaManager->addFormatsAndUrl($mediaApi);
        $formats = $mediaApi->getThumbnails();

        if (!isset($formats[$this->searchImageFormat])) {
            $this->logger->warning(sprintf(
                'Media with ID "%s" does not have thumbnail format "%s". This thumbnail would be used by the search results.',
                $media->getId(),
                $this->searchImageFormat
            ));

            return;
        }

        return $formats[$this->searchImageFormat];
    }
private function getImageUrl ( $ media , $ locale ) { $ mediaApi = new Media ( $ media , $ locale ) ; $ this -> mediaManager -> addFormatsAndUrl ( $ mediaApi ) ; $ formats = $ mediaApi -> getThumbnails ( ) ; if ( ! isset ( $ formats [ $ this -> searchImageFormat ] ) ) { $ this -> logger -> warning ( sprintf ( 'Media with ID "%s" does not have thumbnail format "%s". This thumbnail would be used by the search results.' , $ media -> getId ( ) , $ this -> searchImageFormat ) ) ; return ; } return $ formats [ $ this -> searchImageFormat ] ; }
Return the image URL for the given media.

TODO: The media API needs to be improved here.
Return the image URL for the given media .