I am trying to have a user upload a picture that has been chosen with filepicker and then edited with aviary. I can get the new url for the image when it is saved, but I am unsure of how to get it to persist (i.e. I would like this url to remain permanent so I can save it in a database and constantly use the image). Is there a way to do this? Thank you for your help. Here is my code now:
$(function() {
var a=new Aviary.Feather({
apiKey:'##################',
apiVersion:2,
tools: 'all',
initTool: 'crop',
cropPresets: [['Square','1:1']],
onSave: function(imageID, newURL) {
/*
filepicker.store(newURL,{},function(new_fpfile) {
console.log(JSON.stringify(new_fpfile));
});
*/
//used to store the url, but I assume this url is temporary
$.getJSON(
"/aviary_store.php", // The server URL
{ aviary_id : newURL }, // Data you want to pass to the server.
function(json) {
var aviary_url = json[0];
});
console.log(JSON.stringify(newURL));
console.log(JSON.stringify(imageID));
},
onError:function(a){},appendTo:"editpane"});filepicker.setKey(server_vars.apikey);$(".openbutton").click(function(){filepicker.pick({mimetype:'image/*'},function(b){var c=$('<img id="#editimage"/>');c.attr("src",b.url);$(".editpane").empty().append(c);a.launch({image:c[0],url:b.url});});});});
The best way is to use filepicker.storeUrl
, which will take the contents of the saved aviary image and download it for permanent storage on your S3