Skip to content

Instantly share code, notes, and snippets.

@Pcushing
Last active December 11, 2015 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pcushing/4549106 to your computer and use it in GitHub Desktop.
Save Pcushing/4549106 to your computer and use it in GitHub Desktop.
$('#filepicker-single-license').on('click', function(e){
e.preventDefault();
var featherEditor = new Aviary.Feather({
apiKey: '1V6FW064w0CkvYNV2rihHg',
apiVersion: 2,
tools: ['crop', 'orientation', 'blemish'],
onSave: function(imageID, newURL) {
// var newFPFile = new FPFile({url: newURL}); //Need to get this piece working
filepicker.store(
newURL, //this isn't right, need to pass a FPFile object or something similar
{mimetype:'image/png'},
function(FPFile){
var fileUrl = FPFile["url"];
$('.license-no-image').addClass('hide');
$('#license_file_url').val(fileUrl);
$('#license-preview').attr('src', fileUrl).removeClass('hide');
$('.control-group').removeClass('hide');
}
);
},
appendTo: 'injection_site'
});
var preview = $('#license-preview')[0];
filepicker.pick({
mimetype: 'image/*',
container: 'window',
services: imageSources,
},
function(fpfile) {
preview.src = fpfile.url;
featherEditor.launch({
image: preview,
url: fpfile.url
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment