diff --git a/README.md b/README.md index 700722b..6eb650c 100644 --- a/README.md +++ b/README.md @@ -71,20 +71,20 @@ Documentation consists of template and API docs produced from the plugin JS code * [camera](#module_camera) - * [.getPicture(successCallback, errorCallback, options)](#module_camera.getPicture) - * [.cleanup()](#module_camera.cleanup) - * [.onError](#module_camera.onError) : function - * [.onSuccess](#module_camera.onSuccess) : function - * [.CameraOptions](#module_camera.CameraOptions) : Object + * [.getPicture(successCallback, errorCallback, options)](#module_camera.getPicture) + * [.cleanup()](#module_camera.cleanup) + * [.onError](#module_camera.onError) : function + * [.onSuccess](#module_camera.onSuccess) : function + * [.CameraOptions](#module_camera.CameraOptions) : Object * [Camera](#module_Camera) - * [.DestinationType](#module_Camera.DestinationType) : enum - * [.EncodingType](#module_Camera.EncodingType) : enum - * [.MediaType](#module_Camera.MediaType) : enum - * [.PictureSourceType](#module_Camera.PictureSourceType) : enum - * [.PopoverArrowDirection](#module_Camera.PopoverArrowDirection) : enum - * [.Direction](#module_Camera.Direction) : enum + * [.DestinationType](#module_Camera.DestinationType) : enum + * [.EncodingType](#module_Camera.EncodingType) : enum + * [.MediaType](#module_Camera.MediaType) : enum + * [.PictureSourceType](#module_Camera.PictureSourceType) : enum + * [.PopoverArrowDirection](#module_Camera.PopoverArrowDirection) : enum + * [.Direction](#module_Camera.Direction) : enum * [CameraPopoverHandle](#module_CameraPopoverHandle) * [CameraPopoverOptions](#module_CameraPopoverOptions) @@ -97,11 +97,11 @@ Documentation consists of template and API docs produced from the plugin JS code ### camera.getPicture(successCallback, errorCallback, options) Takes a photo using the camera, or retrieves a photo from the device's image gallery. The image is passed to the success callback as a -base64-encoded `String`, or as the URI for the image file. +base64-encoded `String`, or as the URI for the image file. The `camera.getPicture` function opens the device's default camera application that allows users to snap pictures by default - this behavior occurs, -when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`](#module_Camera.PictureSourceType). +when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`](#module_Camera.PictureSourceType). Once the user snaps the photo, the camera application closes and the application is restored. If `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or @@ -136,11 +136,17 @@ than `DATA_URL`. __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) +- Android +- BlackBerry +- Browser +- Firefox +- FireOS +- iOS +- Windows +- WP8 +- Ubuntu -* [More examples](#camera-getPicture-examples) - -* [Quirks](#camera-getPicture-quirks) +More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks). **Kind**: static method of [camera](#module_camera) @@ -163,7 +169,7 @@ after calling [`camera.getPicture`](#module_camera.getPicture). Applies only whe __Supported Platforms__ -![](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) +- iOS **Kind**: static method of [camera](#module_camera) **Example** @@ -331,12 +337,12 @@ A handle to an image picker popover. __Supported Platforms__ -![](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) +- iOS **Example** ```js var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail, -{ +{ destinationType: Camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.PHOTOLIBRARY, popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY) diff --git a/www/Camera.js b/www/Camera.js index 5ddaf09..70010ee 100644 --- a/www/Camera.js +++ b/www/Camera.js @@ -25,7 +25,7 @@ var argscheck = require('cordova/argscheck'), // XXX: commented out //CameraPopoverHandle = require('./CameraPopoverHandle'); -/** +/** * @namespace navigator */ @@ -80,37 +80,37 @@ for (var key in Camera) { /** * @description Takes a photo using the camera, or retrieves a photo from the device's * image gallery. The image is passed to the success callback as a - * base64-encoded `String`, or as the URI for the image file. - * + * base64-encoded `String`, or as the URI for the image file. + * * The `camera.getPicture` function opens the device's default camera * application that allows users to snap pictures by default - this behavior occurs, - * when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`]{@link module:Camera.PictureSourceType}. + * when `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`]{@link module:Camera.PictureSourceType}. * Once the user snaps the photo, the camera application closes and the application is restored. - * + * * If `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or * `Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a dialog displays * that allows users to select an existing image. The * `camera.getPicture` function returns a [`CameraPopoverHandle`]{@link module:CameraPopoverHandle} object, * which can be used to reposition the image selection dialog, for * example, when the device orientation changes. - * + * * The return value is sent to the [`cameraSuccess`]{@link module:camera.onSuccess} callback function, in * one of the following formats, depending on the specified * `cameraOptions`: - * + * * - A `String` containing the base64-encoded photo image. - * + * * - A `String` representing the image file location on local storage (default). - * + * * You can do whatever you want with the encoded image or URI, for * example: - * + * * - Render the image in an `` tag, as in the example below - * + * * - Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.) - * + * * - Post the data to a remote server - * + * * __NOTE__: Photo resolution on newer devices is quite good. Photos * selected from the device's gallery are not downscaled to a lower * quality, even if a `quality` parameter is specified. To avoid common @@ -119,11 +119,18 @@ for (var key in Camera) { * * __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) + * - Android + * - BlackBerry + * - Browser + * - Firefox + * - FireOS + * - iOS + * - Windows + * - WP8 + * - Ubuntu * - * * [More examples](#camera-getPicture-examples) + * More examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks). * - * * [Quirks](#camera-getPicture-quirks) * @example * navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions); * @param {module:camera.onSuccess} successCallback @@ -164,11 +171,11 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) { * * __Supported Platforms__ * - * ![](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) + * - iOS * * @example * navigator.camera.cleanup(onSuccess, onFail); - * + * * function onSuccess() { * console.log("Camera cleanup success.") * } diff --git a/www/ios/CameraPopoverHandle.js b/www/ios/CameraPopoverHandle.js index 83d57db..3990e18 100644 --- a/www/ios/CameraPopoverHandle.js +++ b/www/ios/CameraPopoverHandle.js @@ -21,7 +21,7 @@ var exec = require('cordova/exec'); -/** +/** * @namespace navigator */ @@ -30,16 +30,16 @@ var exec = require('cordova/exec'); * * __Supported Platforms__ * - * ![](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) + * - iOS * * @example * var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail, - * { + * { * destinationType: Camera.DestinationType.FILE_URI, * sourceType: Camera.PictureSourceType.PHOTOLIBRARY, * popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY) * }); - * + * * // Reposition the popover if the orientation changes. * window.onorientationchange = function() { * var cameraPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);