public function resize(ImageInterface $imageMedia, array $options)
    {
        $this->prepareRouterContext();

        $absoluteUrlOption = isset($options['absolute_url'])
            ? $options['absolute_url']
            : false;
        $routeReferenceType = $this->getReferenceType($absoluteUrlOption);

        $generatedRoute = $this
            ->router
            ->generate($this->imageResizeControllerRouteName, [
                'id' => (int) $imageMedia->getId(),
                'height' => (int) $options['height'],
                'width' => (int) $options['width'],
                'type' => (int) $options['type'],
                '_format' => $imageMedia->getExtension(),
            ], $routeReferenceType);

        $this->fixRouterContext();

        return $generatedRoute;
    }