Using static image in home-made plugin

Hi there,

I'm quite new in the plugin development field, and I'm having trouble displaying a static image.
All I want to do is write a bunch of text (as for now), and display an image right after.

I've set the public/static directory like this:

publicDir: resolve(__dirname, 'public'),

and the file is available at this adress: http://localhost:5603/fiv/plugins/plugin-name/test.jpg.

What is the best way to insert this image ?

<img src="../plugins/plugin-name/test.jpg"/>

This works fine, but does not use the basePath, nor the kbn-source attribute.
I've read that I should be using something like that, but it does not work:

<img kbn-src="/plugins/plugin-name/test.jpg"/>

Cheers

Hi, kbn-src directive was recently removed. You can use chrome.addBasePath() instead:

(we are working on removing the part about kbn-src from these docs` :slight_smile:)

Thank you for your answer. I hadn't thought to look at the new version of the doc on the master branch. :grinning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.