节点红色仪表板包含图像
我正在使用node-red
创build应用程序,并使用node-red-dashboard
创buildui。
我已经包含了一些API调用,并基于我想更改模板控件的图像源的响应。
<img src="/home/pi/Destkop/WeatherImages/sun.png">
所以我使用了图像的绝对path。 但图像没有被加载。 有一个符号,表示图像的来源被设置为localhost:1880/sun.png
。
我在哪里需要放置图像? 我需要使用什么path?
您不能使用本地path从内置于Node-RED的Web服务器提供的文件,因为访问该页面的浏览器可能不在运行Node-RED的同一台机器上。
在settings.js
文件(它将在〜/ .node-red)中有一个名为httpStatic
的设置,你可以使用它来指定一个目录,Node-RED将服务器上的静态内容。
... // When httpAdminRoot is used to move the UI to a different root path, the // following property can be used to identify a directory of static content // that should be served at http://localhost:1880/. //httpStatic: '/home/nol/node-red-static/', ...
如果您将其设置为/ home / pi / Destkop / WeatherImages,如下所示:
... // When httpAdminRoot is used to move the UI to a different root path, the // following property can be used to identify a directory of static content // that should be served at http://localhost:1880/. httpStatic: '/home/pi/Desktop/WeatherImages', ...
你可以设置图像的src如下:
<img src="/sun.png">
- AWS 504网关超时 – 快速中间件的早期响应
- 分离的subprocess在node.js的脚本出口退出
- 使用Visual Studio(不是VSCode)和Node.js工具创build一个Electron应用程序
- $ .NSUserNotificationCenter('defaultUserNotificationCenter')返回null
- mongoose.Promise和promisifyAll有什么区别?
- 无法parsing模块“react / lib / ReactComponentTreeHook”
- 什么是在Openshift的MongoDB大小限制?
- 如何解决“TypeError:callback.apply不是一个函数”?
- I / O绑定和CPU绑定