0
votes

I fail to load image in chrome by TextureLoader

I want to load the image from the URL that is "https://commons.wikimedia.org/wiki/Special:FilePath/Engels.jpg?width=300",but I get error that is "Access to image at 'https://commons.wikimedia.org/wiki/Special:FilePath/Engels.jpg?width=300' (redirected from 'http://commons.wikimedia.org/wiki/Special:FilePath/Engels.jpg?width=300') from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."(I set loader.crossOrigin anonymous).if I set loader.crossOrigin undefined,loader can load the image but can't be rendered with error"THREE.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided."

1

1 Answers

1
votes

Servers at https://commons.wikimedia.org have not implemented Access-Control-Allow-Origin headers, so you may not be able to fetch the image directly.

You can save the image to your local file system and reference it, that would work for sure.