图片未显示在Firebase托管网站上 [英] Images not showing up on firebase hosted website
问题描述
在我的Project/public文件夹中运行命令firebase deploy
,该文件夹包含 index.html , main.css 和 images 文件夹,我的网页是托管的,但是图像未显示在我的网页中.
我遇到了同样的问题. 通过提供相对路径网址解决了该问题
示例:代替使用img src="User/local/..../img/pic.png
使用img src="img/pic.png"
其中img
是公共目录中包含所有图像的文件夹
由于firebase控制台正在从公共目录中读取您的页面(可能是在其他文件夹中完成所有编码后创建的),因此,如果您使用图像的相对路径,则更改父文件夹不会影响网页图像. /p>
现在使用firebase部署.
i run command firebase deploy
in my Project/public folder which contains index.html, main.css and an images folder, my webpage is hosted but images are not showing up in my webpage.
I faced the same problem. Resolved it by providing relative path urls
example: Instead of using img src="User/local/..../img/pic.png
use img src="img/pic.png"
where img
is folder in public directory containing all the images
Since firebase console is reading your page from public directory,( which you might have created after all the coding done in some other folder)so changing the parent folder will not effect the webpage images if you use relative path of image.
Now use firebase deploy.
这篇关于图片未显示在Firebase托管网站上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!