【问题标题】:How can save the image generate to Aviary如何将生成的图像保存到 Aviary
【发布时间】:2016-10-06 12:10:06
【问题描述】:

我有密码

var featherEditor = new Aviary.Feather({
	apiKey: 'your-client-id-here',
	theme: 'light', // Check out our new 'light' and 'dark' themes!
	tools: 'all',
	appendTo: '',
	onSave: function(imageID, newURL) {
		var img = document.getElementById(imageID);
		img.src = newURL;
	},
	onError: function(errorObj) {
		alert(errorObj.message);
	}
});
function launchEditor(id, src) {
	featherEditor.launch({
		image: id,
		url: src
	});
	return false;
}
<!-- Load Feather code -->
<script type="text/javascript" src="http://feather.aviary.com/imaging/v3/editor.js"></script>


<div id='injection_site'></div>

<img id='image1' src='http://images.aviary.com/imagesv5/feather_default.jpg'/>

<!-- Add an edit button, passing the HTML id of the image and the public URL of the image -->
<p><input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', 'http://images.aviary.com/imagesv5/feather_default.jpg');" /></p>

我想将生成的图像保存到 Aviary:https://s3.amazonaws.com/feather-client-files-aviary-prod-us-east-1/2016-06-06/178ba6a3-0488-4b43-b4bc-133cf499c72c.jpg 并插入到 MySQL。

如何获取url并插入MySQL。

非常感谢!

【问题讨论】:

    标签: javascript php jquery mysql aviary


    【解决方案1】:

    如果你还需要答案...

    onSave 函数将显示已编辑图像的亚马逊临时 URL。它在“newURL”变量中。

    因此,您只需运行 Ajax 调用即可将其发送到您的数据库。

    这部分代码在 onSave 函数中。

    $.ajax({
       url: <url_to_your_controller>,
                type:'post',
                data: {
                    image_url : newURL,
                },
                success:function() {
                    alert("Yeah! We did it!")
                }
            });
    

    【讨论】:

    • Arceliver,抱歉没有回复您。我没有找到你的帖子。我对 StackOverflow.com 没有太多经验您的解决方案非常完美!感谢回复!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-30
    • 2017-04-13
    • 2021-04-14
    • 1970-01-01
    • 2018-08-10
    相关资源
    最近更新 更多