简体   繁体   English

节点背景图像不起作用(仅来自Flickr显示的图像)

[英]Node background-image not working (Only images from Flickr display)

I am having trouble getting the background-image node property to work. 我无法让background-image节点属性正常工作。

I am simply using the "Images & breadthfirst layout" demo as a test example (located at https://gist.github.com/maxkfranz/aedff159b0df05ccfaa5 ), but I cannot even get that to work. 我只是使用“图像和广度优先布局”演示作为测试示例(位于https://gist.github.com/maxkfranz/aedff159b0df05ccfaa5 ),但我什至无法使它正常工作。

In the demo, within the 'code.js' file, if I change any image path to anything other than staticflickr, the image will not display. 在演示中的“ code.js”文件中,如果我将任何图像路径更改为除staticflickr以外的任何其他图像,则该图像将不会显示。 For instance: 例如:

If I change 如果我改变

.selector('#bird')
  .css({
    'background-image': 'https://farm8.staticflickr.com/7272/7633179468_3e19e45a0c_b.jpg'
  })

to

.selector('#bird')
  .css({
    'background-image': 'http://astromatrix.org/Content/Images/Objects/Bird.jpg'
  })

The image shows up blank grey in the graph (as shown in the attached image). 该图像在图形中显示为空白灰色(如所附图像所示)。

I have tried local files, multiple other images hosted on different sites, and the only images I can get to work are from flickr. 我尝试了本地文件,在不同站点上托管了多个其他图像,而我只能使用的图像来自flickr。

Am I completely missing something? 我完全错过了什么吗?

Thanks in advance 提前致谢

Blank image for bird when I change the image URL from flickr image 从flickr图像更改图像URL时鸟的空白图像

Use images that you own on your own server. 使用您在自己的服务器上拥有的图像。 You can't use an image if the server doesn't send back the proper headers. 如果服务器未发送回正确的标头,则无法使用图像。

Make sure to refer to the log in the debug console : 确保参考调试控制台中日志

Access to Image at 'http://astromatrix.org/Content/Images/Objects/Bird.jpg' from origin 'http://astromatrix.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM