public function makeFromDataUri($data, $name = null, $mimeType = null)
    {
        if ($data instanceof RawContentInterface) {
            $data = $data->content();
        }

        $resource = @fopen($data, 'r');

        if ( ! $resource) {
            throw new CouldNotReadDataException('Invalid data URI');
        }

        try {
            $meta = stream_get_meta_data($resource);
            // @codeCoverageIgnoreStart
        } catch (Exception $e) {
            throw new CouldNotReadDataException('Failed to interpret Data URI as stream', $e->getCode(), $e);
            // @codeCoverageIgnoreEnd
        }

        if (null === $mimeType) {
            $mimeType = $meta['mediatype'];
        }

        $extension = $this->mimeTypeHelper->guessExtensionForMimeType($mimeType);
        $localPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . md5($meta['uri']) . '.' . $extension;

        if (null === $name) {
            $name = pathinfo($localPath, PATHINFO_BASENAME);
        }

        try {
            file_put_contents($localPath, stream_get_contents($resource));
            // @codeCoverageIgnoreStart
        } catch (Exception $e) {
            throw new CouldNotReadDataException('Failed to make local file from Data URI', $e->getCode(), $e);
            // @codeCoverageIgnoreEnd
        }

        // Always flag as uploaded, since a temp file was created
        return $this->uploaded()->makeFromLocalPath($localPath, $name);
    }