BEDI
BEDI

Reputation: 41

How to display images in meteor

I am writing my code in (root-directory)/imports/ui/body.html and i have an img src tag there which is not working. After searching on the internet found out that we have to store assets in the public folder.After doing so , still i cannot get the image to be displayed.But when i use the image tag in client/main.html i am able to see the image , but not when i add the img src in body.html in imports/ui.

i have tried:

< img src="../../img.jpg" >
< img src="../../client/img.jpg" >

Upvotes: 0

Views: 2256

Answers (2)

Mathieu K.
Mathieu K.

Reputation: 933

Create a folder named "public" in the root directory of your app. Paths in your code will use this folder as the root directory. So putting your image file directly in "public" and accessing it using '/img.jpg' should work.

Upvotes: 1

kkkkkkk
kkkkkkk

Reputation: 7748

If path for your images are root/app/public/img.jpg and root/app/public/client/img.jpg, the use this to access them:

<img src="/img.jpg" />
<img src="/client/img.jpg" />

Upvotes: 2

Related Questions