What is the correct src for the image in my app?


#1

I develop a Kibana (v 5.2.2) app.

There is an image in HTML template: <img src="plugins/myapp/public/image.svg"> And the system path for the image is kibana/plugins/myapp/public/image.svg

I receive the not found error when the template is loaded: https://localhost:5606/obp/app/plugins/sentinl/sentinl_logo.svg 404 (Not Found)

What is the correct src for the image?


(Brandon Kobel) #2

@trex you'll want to exclude the public part from your URL, so you'd use <img src="plugins/myapp/image.svg">.


#3

I put <img src="plugins/sentinl/sentinl_logo.svg">.
And now I have this error:
GET https://localhost:5606/obp/app/plugins/sentinl/sentinl_logo.svg 404 (Not Found)


(Brandon Kobel) #4

@trex apologies, would you try using the kbn-url AngularJS attribute mentioned here https://github.com/elastic/kibana/blob/master/docs/development/core/development-basepath.asciidoc#img-and-a-elements


#5

I tried it, no success. I fixed the image with CSS:

.image {
  height: 170px;
  margin-bottom: 20px;
  background: url('../image.svg') no-repeat;
  background-size: contain;
}

(system) #6

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