我将羽毛鸟舍网络小部件插入我的网站,它看起来和播放都非常棒。但是我很难使用 php 将编辑后的图像保存在本地(从鸟舍服务器到我的服务器),我想将原始图像覆盖为编辑后的图像.我阅读了 aviary 文档(www.aviary.com/web-documentation),但我不明白如何在本地保存编辑后的图像。这是鸟舍的例子:
<script type="text/javascript">
var featherEditor = new Aviary.Feather({
apiKey: '1234567',
apiVersion: 2,
tools: ['draw', 'stickers'],
onSave: function(imageID, newURL) {
var img = document.getElementById(imageID);
img.src = newURL;
},
postUrl: 'http://example.com/featherposturl'
});
function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}
</script>
<!-- Add an edit button, passing the HTML id of the image
and the public URL to the image -->
<a href="#" onclick="return launchEditor('editableimage1',
'http://example.com/public/images/goat.jpg');">Edit!</a>
<!-- original line of HTML here: -->
<img id="editableimage1" src="http://example.com/public/images/goat.jpg"/>
这是php编码:
<?php
$image_data = file_get_contents($_REQUEST['url']);
file_put_contents("photo.jpg",$image_data);
?>