tomomi-chat

Meteor app: images not loading

I am making a simple chat application with a meteor. My HTML:

<body> <h1 align="center">tomomi-chat</h1> <img src="original.gif"> <div class="container" align="center"> {{>entryfield}} </div> <br> <div class="container"> {{>messages}} </div> 

Image does not upload to local server. Since the application is extremely simplified, there are no folders in the directory except the ".meteor" folder. The .js, .css and .html files are located in the application directory.

Even if I post the image and use the external link, the result will be the same. Why is a meteor blocking images from my application?

deployed: http://tomomi.meteor.com/

+5
source share
4 answers

You need to create a folder called public in the root folder of the application.

From the meteorite documentation :

/ public

Files in / public are served to the client as is. Use this to store assets such as images. For example, if you have an image located in /public/background.png, you can include it in your HTML with or in your CSS with a background image: URL (/background.png). Note that / public is not part of the image URL.

+15
source

Create the /public folder. post your images there.

+3
source

In order to dwell on this in detail, I would add an image resource directory to a shared folder like this, and submit it using this

images/transparent.jpg

enter image description here

+2
source

Put the assets in the PROJECT / public folder, and when you specify the link in the tag, just use " xyz.jpg ".

Thats it! The URL does not include the / public folder. This is very correctly made by the meteor frame.

CORRECT β†’ "xyz.jpg"

WRONG β†’ "/public/xyz.jpg"

+2
source

Source: https://habr.com/ru/post/1208561/


All Articles