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;
    }