Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reference an image in Meteor?

Tags:

html

image

meteor

I am displaying an html table in a very basic meteor app - I simply replaced the boilerplate meteor html with my html table, and it looks fine. But I need to add an image after the table, and I tried this:

. . .
</TABLE>
<img border="0" height="640" hspace="0" src="RegConvFAPSSMapWithNumbers.png" width="800" />
</body>

But where I hoped the image would be, I just see the outline of its dimensions and a "busted image" icon.

I first placed the image in the project's main directory (on the same level as <projectName>.css, <projectName>.html (the file I'm trying to add the image to), and <projectName>.js).

I then created a "public\images" folder, and copied the image into there, too, but that makes no difference.

Am I referencing the image wrong, do I have it in the wrong place, or what?

like image 490
B. Clay Shannon-B. Crow Raven Avatar asked Aug 16 '15 20:08

B. Clay Shannon-B. Crow Raven


2 Answers

When you want to reference assets (images, favicon.ico, robots.txt etc.) you should create a top level public folder in your Meteor project.

Since you added your image in public/images, my guess is that you should point to a /images/my_image.png. This below should do the trick:

<img border="0" height="640" hspace="0" src="/images/RegConvFAPSSMapWithNumbers.png" width="800" />
like image 81
Radu Chiriac Avatar answered Oct 11 '22 12:10

Radu Chiriac


Recently I had a similar problem. Just put / before the image path

src="/RegConvFAPSSMapWithNumbers.png"
like image 4
Kasmetski Avatar answered Oct 11 '22 13:10

Kasmetski