Skip to content

Commit

Permalink
adds logic to load uploaded image to filepicker as a base64 image str…
Browse files Browse the repository at this point in the history
…ing #49
  • Loading branch information
jamemackson committed Jul 16, 2015
1 parent b5dc403 commit 40b5d21
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions client/app/pods/admin/artist/images/new/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,30 @@ export default Ember.ObjectController.extend({
},
fileSelected: function(data) {
var self = this;

data.forEach(function (upload){
let image = self.store.createRecord('image', { artist: self.get('model')});
image.set('path', upload.url);

//get a filepicker instance here.
filepicker.read(upload, {base64encode: true},
function(data) {
"use strict";
//console.log(data);
let image = self.store.createRecord('image', { artist: self.get('model')});
image.set('path', 'data:image/jpeg;base64,' + data);
image.save();
},
function(err) {
"use strict";
console.error(err);
},
function(progressPercent) {
"use strict";
//console.log(progressPercent);
}
);

//let image = self.store.createRecord('image', { artist: self.get('model')});
//image.set('path', upload.url);
});
this.send('hidePicker');
},
Expand Down

0 comments on commit 40b5d21

Please sign in to comment.