Upload user profile image

Hi, Newcomer to ember trying to catch up with the bus. I have user model which I need to Upload user profile image. My backend is PHP. I cannot find examples with file Upload. I need cropping functionality if there is capable plugin but that is purely icing.

Anyone who knows how to do it? Google gives me old examples using views. Thanks!

1 Like

Have you tried adobe aviary. Just send the base64 to your php script

with my simple needs aviary is an overkill

Got it well JCrop should be enough either way its just easiest to work with a base64 file

Iā€™m using cropit which works nicely, if you are going to need mobile compatibility then you might need to use something like exif.js to extract the orientation data as well.

In term so of uploading the data, base64 is the way to go but you will need something to handle that on the server side.

1 Like

Thanks guys. I think crop it is simple enough. But I have always hard time to convert JQuery code into Ember.js. I have not find much on the tutorials. So how do I convert this code into Ember Component

$('#image-cropper').cropit(); //how does ember treat this?

// $('#image-cropper').cropit({ imageState: { src: { imageSrc } } }); //again how do I do this in Ember?

// I add an action inside Component and bind the button to that action
$('.download-btn').click(function() {
  var imageData = $('#image-cropper').cropit('export');// Don't know how to do this. May be Ember. $('#image-cropper').cropit('export'); ?? 

Thanks guys for hand of help!

I found nice explanations at sitepoint on using JQuery with Ember components. Basically my problem is solved!