4

I have tried to convert an image from an external source to a base64 string using html and the toDataUrl() and the canvas tag and it does not work. It throws Dom Exception 8 a security exception, which I later found that it doesn't allow you to convert these images from an external source.

I have setup a way doing it server-side, but I wanna reduce the load on my server downloading images. Is there any way around this?

4

1 回答 1

3

您可以在服务器端获取图像,然后像代理一样将其中继到您的客户端。就好像它是在您的服务器上获取的,然后让客户端 JS 进行转换。您的服务器不会进行转换,而只会充当解决安全问题的桥梁。

于 2013-05-09T20:05:50.507 回答