From 2bb134bf6bc627a2da07064057b502b06b076703 Mon Sep 17 00:00:00 2001 From: riknoll Date: Tue, 10 Nov 2015 11:50:42 -0800 Subject: [PATCH] CB-9169 android: Fixed filetype for uncompressed images and added quirk --- README.md | 4 +++- jsdoc2md/TEMPLATE.md | 4 +++- src/android/CameraLauncher.java | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 579b2fa..8060af9 100644 --- a/README.md +++ b/README.md @@ -408,7 +408,7 @@ Can only return photos as base64-encoded image. #### Firefox OS Quirks -Camera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). +Camera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). #### iOS Quirks @@ -451,6 +451,8 @@ Tizen only supports a `destinationType` of - `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album. +- Ignores the `encodingType` parameter if the image is unedited (i.e. `quality` is 100, `correctOrientation` is false, and no `targetHeight` or `targetWidth` are specified). The `CAMERA` source will always return the JPEG file given by the native camera and the `PHOTOLIBRARY` and `SAVEDPHOTOALBUM` sources will return the selected file in its existing encoding. + #### BlackBerry 10 Quirks - Ignores the `quality` parameter. diff --git a/jsdoc2md/TEMPLATE.md b/jsdoc2md/TEMPLATE.md index 7ea3021..d068748 100644 --- a/jsdoc2md/TEMPLATE.md +++ b/jsdoc2md/TEMPLATE.md @@ -85,7 +85,7 @@ Can only return photos as base64-encoded image. #### Firefox OS Quirks -Camera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). +Camera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). #### iOS Quirks @@ -128,6 +128,8 @@ Tizen only supports a `destinationType` of - `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album. +- Ignores the `encodingType` parameter if the image is unedited (i.e. `quality` is 100, `correctOrientation` is false, and no `targetHeight` or `targetWidth` are specified). The `CAMERA` source will always return the JPEG file given by the native camera and the `PHOTOLIBRARY` and `SAVEDPHOTOALBUM` sources will return the selected file in its existing encoding. + #### BlackBerry 10 Quirks - Ignores the `quality` parameter. diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index fb056f4..2a1e62e 100644 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -162,6 +162,13 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect this.targetHeight = -1; } + // We don't return full-quality PNG files. The camera outputs a JPEG + // so requesting it as a PNG provides no actual benefit + if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100 && + !this.correctOrientation && this.encodingType == PNG && this.srcType == CAMERA) { + this.encodingType = JPEG; + } + try { if (this.srcType == CAMERA) { this.callTakePicture(destType, encodingType);