我将羽毛鸟舍网页小部件插入我的网站,它看起来很奇怪。但是我很难用PHP来保存本地编辑的图像(从鸟舍服务器到我的服务器),我想要覆盖原始图像进入已编辑的image.i阅读鸟舍文档(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"/>
HERE是php编码:
<?php
$image_data = file_get_contents($_REQUEST['url']);
file_put_contents("photo.jpg",$image_data);
?>