def mk_image_tag()

in plugins/mkdocs-atlas-formatting-plugin/mkdocs_atlas_formatting_plugin/block.py [0:0]


    def mk_image_tag(self, uri: str) -> str:
        """
        Given an Atlas URI, fetch the image from a running Atlas Standalone server and format
        the output as an image tag, suitable for embedding in an HTML page.

        Input:

        /api/v1/graph?w=200&h=125&no_legend=1&s=e-3h&e=2012-01-01T07:00&tz=UTC&l=0&q=nf.app,alerttest,:eq,name,ssCpuUser,:eq,:and,:sum,80,:gt

        Output:

        <img src="data:image/png;base64,...encoded image..." width="286" height="153">
        """

        data_uri, width, height = self.webserver.get_image(f'{uri}&features=unstable')
        return f'<img src="{data_uri}" width="{width}" height="{height}"/>'