code examples for using onSave, postUrl, postData?

724 views
Skip to first unread message

Simon Huynh

unread,
Feb 8, 2012, 6:21:23 PM2/8/12
to Aviary API
Hi, I plugged the feather web widget into my site and it looks and
plays fantastically. I am having a hard time with saving saved files
though. Probably a large part of the problem is that I'm really
unfamiliar with javascript.

Here is what I have so far:


<script type="text/javascript" src="http://feather.aviary.com/
js/feather.js"></script>
<script type="text/javascript">
var featherEditor = new Aviary.Feather({
apiKey: '########',
apiVersion: 2,
tools:
'enhance,effects,orientation,crop,brightness,contrast,saturation,sharpness,redeye,stickers',
appendTo: '',
cropPresets: [['Profile (square)',
'1:1'], ['Phone', '2:3'], ['Phone (landscape)', '3:2'], 'Custom'],
postUrl: 'http://dev.foomoos.com/
family.php',
postData: [['f', '15'], ['op',
'photoedited']],
onSave: function(imageID, newURL) {
var img = document.getElementById(imageID);
img.src = newURL;
}
});

function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}

</script>



*****

As you can perhaps infer, what I'd like is for the HTTP Post to go to
dev.foomoos.com/family.php, with php variables $_POST['f']=15 and
$_POST['op']='editphoto' . The page, I think, will then respond by
saving the picture image in $_FILES. Or am I getting this wrong?

Ultimately, all I want to do is be able to have the newly edited and
saved photo stored on my server. Perhaps another option would be to
alter the onSave argument? Again, I know very little about
javascript.

Thanks in advance for any help and for your time!

Simon
Reply all
Reply to author
Forward
0 new messages