public function viewImage(ImageInterface $imageMedia, $absoluteUrl = false)
    {
        $this->prepareRouterContext();

        $routeReferenceType = $this->getReferenceType($absoluteUrl);

        $generatedRoute = $this
            ->router
            ->generate($this->imageViewControllerRouteName, [
                'id' => (int) $imageMedia->getId(),
                '_format' => $imageMedia->getExtension(),
            ], $routeReferenceType);

        $this->fixRouterContext();

        return $generatedRoute;
    }
public function viewImage(ImageInterface $imageMedia, $absoluteUrl = false)
    {
        $this->prepareRouterContext();

        $routeReferenceType = $this->getReferenceType($absoluteUrl);

        $generatedRoute = $this
            ->router
            ->generate($this->imageViewControllerRouteName, [
                'id' => (int) $imageMedia->getId(),
                '_format' => $imageMedia->getExtension(),
            ], $routeReferenceType);

        $this->fixRouterContext();

        return $generatedRoute;
    }
public function viewImage ( ImageInterface $ imageMedia , $ absoluteUrl = false ) { $ this -> prepareRouterContext ( ) ; $ routeReferenceType = $ this -> getReferenceType ( $ absoluteUrl ) ; $ generatedRoute = $ this -> router -> generate ( $ this -> imageViewControllerRouteName , [ 'id' => ( int ) $ imageMedia -> getId ( ) , '_format' => $ imageMedia -> getExtension ( ) , ] , $ routeReferenceType ) ; $ this -> fixRouterContext ( ) ; return $ generatedRoute ; }
Return route of image.

@param ImageInterface $imageMedia  Imagemedia element
@param bool           $absoluteUrl If the url generated shoud be absolute

@return string image route
Return route of image .