Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EABCC17C7A for ; Wed, 10 Jun 2015 00:50:05 +0000 (UTC) Received: (qmail 70754 invoked by uid 500); 10 Jun 2015 00:50:05 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 70730 invoked by uid 500); 10 Jun 2015 00:50:05 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 70721 invoked by uid 99); 10 Jun 2015 00:50:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 00:50:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A0C11E00E0; Wed, 10 Jun 2015 00:50:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: muratsu@apache.org To: commits@cordova.apache.org Message-Id: <878c6b15968c488495907095d3abe83d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-plugin-camera git commit: Update docs. This closes #100 Date: Wed, 10 Jun 2015 00:50:05 +0000 (UTC) Repository: cordova-plugin-camera Updated Branches: refs/heads/master 88ee99011 -> 0d37267eb Update docs. This closes #100 Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/0d37267e Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/0d37267e Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/0d37267e Branch: refs/heads/master Commit: 0d37267eb4837b4f8e33d426060a814c7b33ed21 Parents: 88ee990 Author: Murat Sutunc Authored: Wed May 6 22:37:59 2015 -0700 Committer: Murat Sutunc Committed: Tue Jun 9 17:46:49 2015 -0700 ---------------------------------------------------------------------- README.md | 157 +++++++++++++++++------------------- doc/img/android-fail.png | Bin 0 -> 753 bytes doc/img/android-success.png | Bin 0 -> 716 bytes doc/img/blackberry-fail.png | Bin 0 -> 1009 bytes doc/img/blackberry-success.png | Bin 0 -> 984 bytes doc/img/browser-fail.png | Bin 0 -> 806 bytes doc/img/browser-success.png | Bin 0 -> 776 bytes doc/img/firefox-fail.png | Bin 0 -> 802 bytes doc/img/firefox-success.png | Bin 0 -> 770 bytes doc/img/fireos-fail.png | Bin 0 -> 965 bytes doc/img/fireos-success.png | Bin 0 -> 936 bytes doc/img/ios-fail.png | Bin 0 -> 573 bytes doc/img/ios-success.png | Bin 0 -> 550 bytes doc/img/ubuntu-fail.png | Bin 0 -> 649 bytes doc/img/ubuntu-success.png | Bin 0 -> 622 bytes doc/img/windows-fail.png | Bin 0 -> 784 bytes doc/img/windows-success.png | Bin 0 -> 759 bytes doc/img/wp8-fail.png | Bin 0 -> 714 bytes doc/img/wp8-success.png | Bin 0 -> 679 bytes 19 files changed, 73 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 5a18c37..f64ca0f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,16 @@ Although the object is attached to the global scoped `navigator`, it is not avai cordova plugin add cordova-plugin-camera +## API +- Camera + - navigator.camera.getPicture(success, fail, options) + - CameraOptions + - CameraPopoverHandle + - CameraPopoverOptions + - navigator.camera.cleanup + + + ## navigator.camera.getPicture Takes a photo using the camera, or retrieves a photo from the device's @@ -43,9 +53,9 @@ base64-encoded `String`, or as the URI for the image file. The method itself returns a `CameraPopoverHandle` object that can be used to reposition the file selection popover. - navigator.camera.getPicture( cameraSuccess, cameraError, cameraOptions ); + navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions); -### Description +#### Description The `camera.getPicture` function opens the device's default camera application that allows users to snap pictures. This behavior occurs @@ -83,47 +93,68 @@ quality, even if a `quality` parameter is specified. To avoid common memory problems, set `Camera.destinationType` to `FILE_URI` rather than `DATA_URL`. -### Supported Platforms +#### Supported Platforms + +![](doc/img/android-success.png) ![](doc/img/blackberry-success.png) ![](doc/img/browser-success.png) ![](doc/img/firefox-success.png) ![](doc/img/fireos-success.png) ![](doc/img/ios-success.png) ![](doc/img/windows-success.png) ![](doc/img/wp8-success.png) ![](doc/img/ubuntu-success.png) + +#### Example + +Take a photo and retrieve it as a base64-encoded image: + + navigator.camera.getPicture(onSuccess, onFail, { quality: 50, + destinationType: Camera.DestinationType.DATA_URL + }); -- Amazon Fire OS -- Android -- BlackBerry 10 -- Browser -- Firefox OS -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 -- Windows + function onSuccess(imageData) { + var image = document.getElementById('myImage'); + image.src = "data:image/jpeg;base64," + imageData; + } -### Preferences (iOS) + function onFail(message) { + alert('Failed because: ' + message); + } + +Take a photo and retrieve the image's file location: + + navigator.camera.getPicture(onSuccess, onFail, { quality: 50, + destinationType: Camera.DestinationType.FILE_URI }); + + function onSuccess(imageURI) { + var image = document.getElementById('myImage'); + image.src = imageURI; + } + + function onFail(message) { + alert('Failed because: ' + message); + } + +#### Preferences (iOS) - __CameraUsesGeolocation__ (boolean, defaults to false). For capturing JPEGs, set to true to get geolocation data in the EXIF header. This will trigger a request for geolocation permissions if set to true. - -### Amazon Fire OS Quirks +#### Amazon Fire OS Quirks Amazon Fire OS uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the image may not appear when the cordova activity is restored. -### Android Quirks +#### Android Quirks Android uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the image may not appear when the Cordova activity is restored. -### Browser Quirks +#### Browser Quirks Can only return photos as base64-encoded image. -### Firefox OS Quirks +#### Firefox OS Quirks Camera plugin is currently implemented using [Web Activities](https://hacks.mozilla.org/2013/01/introducing-web-activities/). -### iOS Quirks +#### iOS Quirks Including a JavaScript `alert()` in either of the callback functions can cause problems. Wrap the alert within a `setTimeout()` to allow @@ -134,48 +165,17 @@ displays: // do your thing here! }, 0); -### Windows Phone 7 Quirks +#### Windows Phone 7 Quirks Invoking the native camera application while the device is connected via Zune does not work, and triggers an error callback. -### Tizen Quirks +#### Tizen Quirks Tizen only supports a `destinationType` of `Camera.DestinationType.FILE_URI` and a `sourceType` of `Camera.PictureSourceType.PHOTOLIBRARY`. -### Example - -Take a photo and retrieve it as a base64-encoded image: - - navigator.camera.getPicture(onSuccess, onFail, { quality: 50, - destinationType: Camera.DestinationType.DATA_URL - }); - - function onSuccess(imageData) { - var image = document.getElementById('myImage'); - image.src = "data:image/jpeg;base64," + imageData; - } - - function onFail(message) { - alert('Failed because: ' + message); - } - -Take a photo and retrieve the image's file location: - - navigator.camera.getPicture(onSuccess, onFail, { quality: 50, - destinationType: Camera.DestinationType.FILE_URI }); - - function onSuccess(imageURI) { - var image = document.getElementById('myImage'); - image.src = imageURI; - } - - function onFail(message) { - alert('Failed because: ' + message); - } - ## CameraOptions Optional parameters to customize the camera settings. @@ -190,8 +190,6 @@ Optional parameters to customize the camera settings. popoverOptions: CameraPopoverOptions, saveToPhotoAlbum: false }; -### Options - - __quality__: Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no loss from file compression. The default is 50. _(Number)_ (Note that information about the camera's resolution is unavailable.) - __destinationType__: Choose the format of the return value. The default is FILE_URI. Defined in `navigator.camera.DestinationType` _(Number)_ @@ -244,7 +242,7 @@ Optional parameters to customize the camera settings. FRONT : 1 // Use the front-facing camera }; -### Amazon Fire OS Quirks +#### Amazon Fire OS Quirks - Any `cameraDirection` value results in a back-facing photo. @@ -252,7 +250,7 @@ Optional parameters to customize the camera settings. - `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album. -### Android Quirks +#### Android Quirks - Any `cameraDirection` value results in a back-facing photo. @@ -261,7 +259,7 @@ with the Google Plus Photos application. Other crops may not work. - `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album. -### BlackBerry 10 Quirks +#### BlackBerry 10 Quirks - Ignores the `quality` parameter. @@ -273,7 +271,7 @@ with the Google Plus Photos application. Other crops may not work. - Ignores the `cameraDirection` parameter. -### Firefox OS Quirks +#### Firefox OS Quirks - Ignores the `quality` parameter. @@ -293,19 +291,19 @@ with the Google Plus Photos application. Other crops may not work. - Ignores the `cameraDirection` parameter. -### iOS Quirks +#### iOS Quirks - Set `quality` below 50 to avoid memory errors on some devices. - When using `destinationType.FILE_URI`, photos are saved in the application's temporary directory. The contents of the application's temporary directory is deleted when the application ends. -### Tizen Quirks +#### Tizen Quirks - options not supported - always returns a FILE URI -### Windows Phone 7 and 8 Quirks +#### Windows Phone 7 and 8 Quirks - Ignores the `allowEdit` parameter. @@ -327,7 +325,7 @@ onError callback function that provides an error message. // Show a helpful message } -### Parameters +#### Description - __message__: The message is provided by the device's native code. _(String)_ @@ -340,11 +338,11 @@ onSuccess callback function that provides the image data. // Do something with the image } -### Parameters +#### Description - __imageData__: Base64 encoding of the image data, _or_ the image file URI, depending on `cameraOptions` in effect. _(String)_ -### Example +#### Example // Show image // @@ -358,23 +356,15 @@ onSuccess callback function that provides the image data. A handle to the popover dialog created by `navigator.camera.getPicture`. -### Methods - -- __setPosition__: Set the position of the popover. +#### Description -### Supported Platforms +- __setPosition__: Set the position of the popover. Takes the `CameraPopoverOptions` that specify the new position. -- iOS +#### Supported Platforms -### setPosition +![](doc/img/android-fail.png) ![](doc/img/blackberry-fail.png) ![](doc/img/browser-fail.png) ![](doc/img/firefox-fail.png) ![](doc/img/fireos-fail.png) ![](doc/img/ios-success.png) ![](doc/img/windows-fail.png) ![](doc/img/wp8-fail.png) ![](doc/img/ubuntu-fail.png) -Set the position of the popover. - -__Parameters__: - -- `cameraPopoverOptions`: the `CameraPopoverOptions` that specify the new position - -### Example +#### Example var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail, { destinationType: Camera.DestinationType.FILE_URI, @@ -388,7 +378,6 @@ __Parameters__: cameraPopoverHandle.setPosition(cameraPopoverOptions); } - ## CameraPopoverOptions iOS-only parameters that specify the anchor element location and arrow @@ -402,7 +391,7 @@ or album. arrowDir : Camera.PopoverArrowDirection.ARROW_ANY }; -### CameraPopoverOptions +#### Description - __x__: x pixel coordinate of screen element onto which to anchor the popover. _(Number)_ @@ -434,18 +423,18 @@ storage. navigator.camera.cleanup( cameraSuccess, cameraError ); -### Description +#### Description Removes intermediate image files that are kept in temporary storage after calling `camera.getPicture`. Applies only when the value of `Camera.sourceType` equals `Camera.PictureSourceType.CAMERA` and the `Camera.destinationType` equals `Camera.DestinationType.FILE_URI`. -### Supported Platforms +#### Supported Platforms -- iOS +![](doc/img/android-fail.png) ![](doc/img/blackberry-fail.png) ![](doc/img/browser-fail.png) ![](doc/img/firefox-fail.png) ![](doc/img/fireos-fail.png) ![](doc/img/ios-success.png) ![](doc/img/windows-fail.png) ![](doc/img/wp8-fail.png) ![](doc/img/ubuntu-fail.png) -### Example +#### Example navigator.camera.cleanup(onSuccess, onFail); http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/android-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/android-fail.png b/doc/img/android-fail.png new file mode 100644 index 0000000..f9e4e86 Binary files /dev/null and b/doc/img/android-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/android-success.png ---------------------------------------------------------------------- diff --git a/doc/img/android-success.png b/doc/img/android-success.png new file mode 100644 index 0000000..0bb9abd Binary files /dev/null and b/doc/img/android-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/blackberry-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/blackberry-fail.png b/doc/img/blackberry-fail.png new file mode 100644 index 0000000..b89efaf Binary files /dev/null and b/doc/img/blackberry-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/blackberry-success.png ---------------------------------------------------------------------- diff --git a/doc/img/blackberry-success.png b/doc/img/blackberry-success.png new file mode 100644 index 0000000..286d0b9 Binary files /dev/null and b/doc/img/blackberry-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/browser-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/browser-fail.png b/doc/img/browser-fail.png new file mode 100644 index 0000000..3894be6 Binary files /dev/null and b/doc/img/browser-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/browser-success.png ---------------------------------------------------------------------- diff --git a/doc/img/browser-success.png b/doc/img/browser-success.png new file mode 100644 index 0000000..6c2c000 Binary files /dev/null and b/doc/img/browser-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/firefox-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/firefox-fail.png b/doc/img/firefox-fail.png new file mode 100644 index 0000000..2c6cbd1 Binary files /dev/null and b/doc/img/firefox-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/firefox-success.png ---------------------------------------------------------------------- diff --git a/doc/img/firefox-success.png b/doc/img/firefox-success.png new file mode 100644 index 0000000..deb9d24 Binary files /dev/null and b/doc/img/firefox-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/fireos-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/fireos-fail.png b/doc/img/fireos-fail.png new file mode 100644 index 0000000..b1e7b9b Binary files /dev/null and b/doc/img/fireos-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/fireos-success.png ---------------------------------------------------------------------- diff --git a/doc/img/fireos-success.png b/doc/img/fireos-success.png new file mode 100644 index 0000000..7b6289e Binary files /dev/null and b/doc/img/fireos-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/ios-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/ios-fail.png b/doc/img/ios-fail.png new file mode 100644 index 0000000..2d8caf8 Binary files /dev/null and b/doc/img/ios-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/ios-success.png ---------------------------------------------------------------------- diff --git a/doc/img/ios-success.png b/doc/img/ios-success.png new file mode 100644 index 0000000..3bf3b5a Binary files /dev/null and b/doc/img/ios-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/ubuntu-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/ubuntu-fail.png b/doc/img/ubuntu-fail.png new file mode 100644 index 0000000..ca82c79 Binary files /dev/null and b/doc/img/ubuntu-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/ubuntu-success.png ---------------------------------------------------------------------- diff --git a/doc/img/ubuntu-success.png b/doc/img/ubuntu-success.png new file mode 100644 index 0000000..b15227d Binary files /dev/null and b/doc/img/ubuntu-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/windows-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/windows-fail.png b/doc/img/windows-fail.png new file mode 100644 index 0000000..982a8cf Binary files /dev/null and b/doc/img/windows-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/windows-success.png ---------------------------------------------------------------------- diff --git a/doc/img/windows-success.png b/doc/img/windows-success.png new file mode 100644 index 0000000..b8ae79b Binary files /dev/null and b/doc/img/windows-success.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/wp8-fail.png ---------------------------------------------------------------------- diff --git a/doc/img/wp8-fail.png b/doc/img/wp8-fail.png new file mode 100644 index 0000000..28c4588 Binary files /dev/null and b/doc/img/wp8-fail.png differ http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d37267e/doc/img/wp8-success.png ---------------------------------------------------------------------- diff --git a/doc/img/wp8-success.png b/doc/img/wp8-success.png new file mode 100644 index 0000000..a37cad6 Binary files /dev/null and b/doc/img/wp8-success.png differ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org