I am beginner of ionic3, I have a api with some params and image to send back to server, i have crop the image with below code:
this.camera.getPicture(cameraOptions)
.then(file_uri => {
this.crop.crop(file_uri, {quality: 100})
.then(
newImage => {console.log('new image path is: ' + newImage);
this.imageSrc = newImage},
error => console.error('Error cropping image', error)
);
},
err => console.log(err));
and my calling api code is:
let opt: RequestOptions;
let myHeaders: Headers = new Headers;
myHeaders.set('Accept', 'application/json; charset=utf-8');
myHeaders.append('Content-type', 'application/json; charset=utf-8');
opt = new RequestOptions({
headers: myHeaders
})
return new Promise((resolve, reject) => {
console.log(apiUrl);
this.http.post(apiUrl+'register?email='+email+'&userImg='+userImg, opt)
.map(res => res.json())
.subscribe(data => {
this.data = data;
resolve(this.data);
},(err) => {
reject(err);
});
});
above email is the param & userImg is the image that I want to send back to server. My Question is how can I put this cropped image with other params to call the api? Thanks a lot. Hope for a reply~Thanks again.