public function getContent(string $filename, array $options = []): ?string
    {
        if (!empty($options)) {
            $this->validateOptions($options);
        }
        $urlOptions = [];
        if (isset($options['width'])) {
            $urlOptions['width'] = $options['width'];
        }
        if (isset($options['height'])) {
            $urlOptions['height'] = $options['height'];
        }
        if (isset($options['outputType'])) {
            $urlOptions['outputType'] = $options['outputType'];
        }
        $url = $this->getURL($filename, $urlOptions);
        $path = substr($url, strlen($this->app->request->base));

        $request = new \BearFramework\App\Request();
        $request->path->set($path);
        $response = $this->getResponse($request);
        if ($response === null) {
            return null;
        }
        $content = file_get_contents($response->filename);
        if (isset($options['encoding'])) {
            if ($options['encoding'] === 'base64') {
                return base64_encode($content);
            } elseif ($options['encoding'] === 'data-uri') {
                $mimeType = $this->getMimeType($filename);
                return 'data:' . $mimeType . ',' . $content;
            } elseif ($options['encoding'] === 'data-uri-base64') {
                $mimeType = $this->getMimeType($filename);
                return 'data:' . $mimeType . ';base64,' . base64_encode($content);
            } else {
                throw new \InvalidArgumentException('Unsupported encoding type (' . $options['encoding'] . ')');
            }
        }
        return $content;
    }