Gallery gallery photos for camera plugin

I use the Cordova 2.6 Camera plugin to receive images from the device gallery, I get them with base64 encoding, and I tried to compress them to a lower quality using the "quality" option.

I noticed that compression does not work, and when I read the Cordoba documentation at https://github.com/apache/cordova-plugin-camera/blob/master/doc/index.md , I can read:

NOTE. The resolution of photos on new devices is not bad. selected photos from the device’s gallery are not reduced to a lower quality , even if the quality parameter is specified. To avoid shared memory issues, set Camera.destinationType to FILE_URI, not DATA_URL.

In my case, I can only use DATA_URL, since I use base64 encryption to upload an image with a third-party web service. I also use only images from the device gallery (not from the camera itself). I have performance problems, mainly on Windows Phone. My application takes too long to process base64 data due to image size (I am testing large images stored in the device gallery but which were captured using a 5 megapixel or 8 megapixel telephone camera).

My question is, is there a solution to get the "quality" parameter that works for gallery photos in the Cordoba plugin?

Is there any custom plugin or plug where we can compress photos of the device gallery?

Is there any other alternative that you offer? (for example, a custom native plugin that uses FILE_URI and returns compression of a compressed base64 image)

+7
cordova camera image-gallery windows-phone-8
source share
1 answer

we use the following parameters when calling .getPicture:

quality: 50, destinationType: Camera.DestinationType.DATA_URL, encodingType: Camera.EncodingType.JPEG, sourceType: Camera.PictureSourceType.CAMERA, targetWidth: 800, correctOrientation: true 

The quality setting does not seem to affect the file size too much. targetWidth and, for some odd reason, correctOrientation do. The resulting image size with these settings is about 24 kB, depending on the resolution of the device’s camera.

0
source share

All Articles