Image Encoding issue in ionic 3

I want to display an action sheet with options to select from gallery or from camera and then send base64 encoded string to the API.But when I select from camera it is throwing me Payload too large error.I even tried clicking a pic from camera and then selecting it froom gallery in the app but it is doing same. Below is my code.Thanks in advance :slight_smile:

public takePicture(sourceType) {
// Create options for the Camera Dialog
var options = {
quality: 50,
sourceType: sourceType,
saveToPhotoAlbum: false,
correctOrientation: true,
//encodingType: this.camera.EncodingType.JPEG,
destinationType: 0
};
// Get the data of an image
this.camera.getPicture(options).then((imagePath) => {
this.pic=imagePath;
this.pictureForExibition=ā€˜data:image/jpeg;base64,ā€™+imagePath;
}, (err) => {
this.presentToast(ā€˜Error while selecting image.ā€™);
});
}
and the API hit

supply_details(supplyData){
console.log(ā€œcoming in the functionā€)
console.log(this.pic);
var url = ā€˜Myurlā€™;
var filename = this.createFileName();
var headers = new Headers();
headers.append(ā€œAcceptā€, ā€˜application/jsonā€™);
headers.append(ā€˜Content-Typeā€™, ā€˜application/jsonā€™ );
headers.append(ā€˜Cache-Controlā€™, ā€˜no-cacheā€™ );
this.loading = this.loadingCtrl.create({
content: ā€˜Uploadingā€¦ā€™,
});
this.loading.present();
let options = new RequestOptions({ headers: headers });
let body={
ā€œimageā€:this.pictureForExibition,
ā€œnameā€:filename
}
console.log(body);
this.http.post(url, body, options)
.subscribe(data => {
console.log(data)
this.loading.dismiss();
this.presentAlert(ā€œProduct Upload Successfullyā€);
this.app.getRootNav().setRoot(SomePage);
}, error => {
console.log(ā€œcoming in errorā€)
this.loading.dismiss();
let er=error.json();
console.log(er);
this.presentAlert(ā€œError Uploading file to our servers!ā€);
});
}