Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在CamanJS中编辑远程图像_Javascript_Php_Proxy_Camanjs - Fatal编程技术网

Javascript 如何在CamanJS中编辑远程图像

Javascript 如何在CamanJS中编辑远程图像,javascript,php,proxy,camanjs,Javascript,Php,Proxy,Camanjs,文件上说 CamanJS附带了一个PHP代理(欢迎使用您选择的语言添加代理),您可以在proxies文件夹中使用该代理。在使用CamanJS进行编辑之前,启用代理所需做的一切是: 读完后,我写了以下代码 <script> Caman.remoteProxy = Caman.IO.useProxy('php'); more javaScript here. </script> Caman.remoteProxy=Caman.IO.useProxy('php'); 这里有

文件上说

CamanJS附带了一个PHP代理(欢迎使用您选择的语言添加代理),您可以在proxies文件夹中使用该代理。在使用CamanJS进行编辑之前,启用代理所需做的一切是:

读完后,我写了以下代码

<script>
Caman.remoteProxy = Caman.IO.useProxy('php');
more javaScript here.
</script>

Caman.remoteProxy=Caman.IO.useProxy('php');
这里有更多的javaScript。

出于安全原因,浏览器显示无法编辑。我写错了吗?我必须在某处包含一个php文件吗。PHP文件在哪里?

您必须在服务器上托管PHP脚本(可在存储库的文件夹中找到),这样它就可以在与提供CamanJS的页面完全相同的域中找到。此脚本将图像数据从远程源代理到浏览器,以绕过此限制。当然,您并不局限于使用提供的PHP脚本。你可以使用任何你想要的服务器端语言,只要它做同样的事情

或者,如果您可以控制源,则可以向服务器响应中添加跨源资源共享(CORS)头,这将告诉浏览器,尽管域不同,仍可以使用映像

<script>
Caman.remoteProxy = Caman.IO.useProxy('php');
more javaScript here.
</script>