private function resizeImage($fileName)
    {
        list($width, $height, $mode) = $this->getResizeImages();
        if ($this->getShowImages() && ($width || $height || $mode)) {
            if ($this->imageFactory) {
                $image = $this->imageFactory->create(
                    $this->rootDir . '/' . $fileName,
                    [$width, $height, $mode]
                );

                return $image->getUrl($this->rootDir);
            }

            $event = new ResizeImageEvent($fileName, $width, $height, $mode);
            $this->dispatcher->dispatch(ContaoEvents::IMAGE_RESIZE, $event);
            return $event->getResultImage();
        }

        return $fileName;
    }