Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let options: CameraOptions = {
- quality: 30,
- targetHeight: 500,
- targetWidth: 500,
- destinationType: this.camera.DestinationType.DATA_URL,
- encodingType: this.camera.EncodingType.JPEG,
- mediaType: this.camera.MediaType.PICTURE,
- correctOrientation: true
- };
- var me = this;
- return this.camera.getPicture(options).then(function(data) {
- return new Promise((resolve, reject) => {
- me.getDimensions("data:image/jpeg;base64," + data, function(results) {
- console.log(`Results for getDimenstions: width - ${results.width}, height - ${results.height}`);
- var img = new ReportImage();
- img.data = "data:image/jpeg;base64," + data;
- img.width = results.width;
- img.height = results.height;
- resolve(img);
- });
- });
- getDimensions(data, cb) {
- var i = new Image();
- i.onload = function(){
- return cb({width: i.naturalWidth, height: i.naturalHeight});
- };
- i.src = data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement