[英]Aframe not loading image from local path in angular and arjs
I am trying to load a image from the local path.我正在尝试从本地路径加载图像。 The code is in app.component.html in angular.
代码在 angular 中的 app.component.html 中。 here is my code:
这是我的代码:
<a-scene embedded arjs>
<a-assets>
<img id="test_img" src="/mnt/r/flipkart/proj/src/app/abcd.jpg">
</a-assets>
<a-marker preset="hiro" url="hiro.patt">
<a-image
rotation="90 0 0"
src="#test_img"></a-image>
<!-- <a-image
rotation="90 0 0"
src="#imge" id="baba"></a-image> -->
</a-marker>
<a-entity camera></a-entity>
<div style='position: fixed; top: 10px; width:100%; text-align: center; z-index: 1;'>
<button (click)="hideme()">
HIDE OBJECTS
</button>
</div>
</a-scene>
On console I am getting this message:在控制台上,我收到此消息:
GET http://localhost:4200/mnt/r/flipkart/proj/src/app/abcd.jpg 404 (Not Found)
how can I get it to avoid making a get request and just use the images from a local folder.我怎样才能得到它以避免发出获取请求而只使用本地文件夹中的图像。
how can I get it to avoid making a get request
我怎样才能得到它以避免发出获取请求
You can specify, that you want to use the file://
protocol, ie: file:///mnt/r/flipkart/proj/src/app/abcd.jpg
您可以指定要使用
file://
协议,即: file:///mnt/r/flipkart/proj/src/app/abcd.jpg
ALTHOUGH images, videos or audio loaded via the file
protocol, won't work with a-frame
due to cross-origin policies . 由于跨域策略,尽管通过文件协议加载的图像、视频或音频都无法与
a-frame
一起使用file
If you're developing locally, you will still need a server to host assets.如果你在本地开发,你仍然需要一个服务器来托管资产。
SimpleHTTPServer
moduleSimpleHTTPServer
模块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.