流星应用程序:图片无法加载 [英] meteor app: images not loading

查看:87
本文介绍了流星应用程序:图片无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与流星制作一个简单的聊天应用程序。我的HTML是:

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



图片不会载入在本地服务器上。由于该应用程序非常简单,除了目录中的.meteor文件夹外,没有其他文件夹。 .js,.css和.html文件都在app目录中。

即使我托管图片并使用外部链接,结果也一样。为什么流星屏蔽来自我的应用程序的图像?



已部署: http: //tomomi.meteor.com/

解决方案

您应该创建一个名为 public 在您的应用程序根文件夹中。



流星文件
$ b


/ public



/ public中的文件按原样提供给客户端。使用它来
存储资产,如图像。例如,如果您的图像位于/public/background.png的
处,您可以将它包含在HTML中,或者在您的CSS中使用background-image:
url(/background.png)。请注意,/ public不是图片网址的一部分。



I'm making a simple chat app with meteor. My HTML is:

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

The image won't load on the local server. As the app is extremely simplistic, there are no folders besides the '.meteor' folder in the directory. The .js, .css, and .html files are all in the app directory.

Even if I host the image and use an external link, the result in the same. Why is meteor blocking images from my app?

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

解决方案

You should create a folder named public in your application root folder.

From the Meteor 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 at /public/background.png, you can include it in your HTML with or in your CSS with background-image: url(/background.png). Note that /public is not part of the image URL.

这篇关于流星应用程序:图片无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆