private function cachedEmbedImage($filePath)
    {
        $filePath = realpath($filePath);
        if (!array_key_exists($filePath, $this->imageCache)) {
            if (is_file($filePath)) {
                $image = \Swift_Image::fromPath($filePath);
                $id = $image->getId();

                // $id and $value must not be the same => this happens if the file cannot be found/read
                if ($id == $filePath) {
                    // @codeCoverageIgnoreStart
                    // add a null-value to the cache for this path, so we don't try again.
                    $this->imageCache[$filePath] = null;
                } else {
                    // @codeCoverageIgnoreEnd
                    // add the image to the cache
                    $this->imageCache[$filePath] = $image;
                }
            }
        }

        return $this->imageCache[$filePath];
    }