{
  "_args": [
    [
      "cordova-plugin-camera@2.4.0",
      "D:\\my\\miao\\miaomiao"
    ],
    [
      {
        "raw": "cordova-plugin-camera",
        "scope": null,
        "escapedName": "cordova-plugin-camera",
        "name": null,
        "rawSpec": "cordova-plugin-camera",
        "spec": "D:\\my\\miao\\miaomiao\\node_modules\\cordova-plugin-camera",
        "type": "directory"
      },
      "D:\\my\\miao\\miaomiao\\node_modules"
    ]
  ],
  "_from": "cordova-plugin-camera@2.4.0",
  "_id": "cordova-plugin-camera@2.4.0",
  "_inCache": true,
  "_location": "/cordova-plugin-camera",
  "_nodeVersion": "6.6.0",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.com",
    "tmp": "tmp/cordova-plugin-camera-2.4.0.tgz_1488934473596_0.5872384253889322"
  },
  "_npmUser": {
    "email": "stevengill97@gmail.com",
    "name": "stevegill"
  },
  "_npmVersion": "4.1.1",
  "_phantomChildren": {},
  "_requested": {
    "raw": "cordova-plugin-camera",
    "scope": null,
    "escapedName": "cordova-plugin-camera",
    "name": null,
    "rawSpec": "cordova-plugin-camera",
    "spec": "D:\\my\\miao\\miaomiao\\node_modules\\cordova-plugin-camera",
    "type": "directory"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_shrinkwrap": null,
  "_spec": "cordova-plugin-camera",
  "_where": "D:\\my\\miao\\miaomiao\\node_modules",
  "author": {
    "name": "Apache Software Foundation"
  },
  "bugs": {
    "url": "https://github.com/apache/cordova-plugin-camera/issues"
  },
  "cordova": {
    "id": "cordova-plugin-camera",
    "platforms": [
      "amazon-fireos",
      "android",
      "blackberry10",
      "browser",
      "firefoxos",
      "ios",
      "ubuntu",
      "windows",
      "windows8",
      "wp7",
      "wp8"
    ]
  },
  "dependencies": {},
  "description": "Cordova Camera Plugin",
  "devDependencies": {
    "dmd-plugin-cordova-plugin": "^0.1.0",
    "husky": "^0.10.1",
    "jsdoc-to-markdown": "^1.2.0",
    "jshint": "^2.6.0"
  },
  "directories": {},
  "dist": {
    "shasum": "87c80c45b52a5132f35732e878f2b0de5419eeb5",
    "tarball": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-2.4.0.tgz"
  },
  "engines": {
    "cordovaDependencies": {
      "3.0.0": {
        "cordova": ">100"
      }
    }
  },
  "homepage": "https://github.com/apache/cordova-plugin-camera#readme",
  "installable": true,
  "keywords": [
    "camera",
    "cordova",
    "cordova-amazon-fireos",
    "cordova-android",
    "cordova-blackberry10",
    "cordova-browser",
    "cordova-firefoxos",
    "cordova-ios",
    "cordova-ubuntu",
    "cordova-windows",
    "cordova-windows8",
    "cordova-wp7",
    "cordova-wp8",
    "ecosystem:cordova"
  ],
  "license": "Apache-2.0",
  "maintainers": [
    {
      "name": "bowserj",
      "email": "bowserj@apache.org"
    },
    {
      "name": "csantanapr",
      "email": "csantana23@gmail.com"
    },
    {
      "name": "filmaj",
      "email": "maj.fil@gmail.com"
    },
    {
      "name": "purplecabbage",
      "email": "purplecabbage@gmail.com"
    },
    {
      "name": "shazron",
      "email": "shazron@gmail.com"
    },
    {
      "name": "stevegill",
      "email": "stevengill97@gmail.com"
    }
  ],
  "name": "cordova-plugin-camera",
  "optionalDependencies": {},
  "readme": "---\ntitle: Camera\ndescription: Take pictures with the device camera.\n---\n<!---\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n-->\n\n|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | Travis CI |\n|:-:|:-:|:-:|:-:|:-:|:-:|\n|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-camera/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-camera/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-camera/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-camera/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-camera)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-camera/)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-camera.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-camera)\n\n# cordova-plugin-camera\n\nThis plugin defines a global `navigator.camera` object, which provides an API for taking pictures and for choosing images from\nthe system's image library.\n\nAlthough the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.\n\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(navigator.camera);\n    }\n\n\n## Installation\n\nThis requires cordova 5.0+\n\n    cordova plugin add cordova-plugin-camera\nOlder versions of cordova can still install via the __deprecated__ id\n\n    cordova plugin add org.apache.cordova.camera\nIt is also possible to install via repo url directly ( unstable )\n\n    cordova plugin add https://github.com/apache/cordova-plugin-camera.git\n\n\n## How to Contribute\n\nContributors are welcome! And we need your contributions to keep the project moving forward. You can [report bugs](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Camera%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC), improve the documentation, or [contribute code](https://github.com/apache/cordova-plugin-camera/pulls).\n\nThere is a specific [contributor workflow](http://wiki.apache.org/cordova/ContributorWorkflow) we recommend. Start reading there. More information is available on [our wiki](http://wiki.apache.org/cordova).\n\n:warning: **Found an issue?** File it on [JIRA issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Camera%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC).\n\n**Have a solution?** Send a [Pull Request](https://github.com/apache/cordova-plugin-camera/pulls).\n\nIn order for your changes to be accepted, you need to sign and submit an Apache [ICLA](http://www.apache.org/licenses/#clas) (Individual Contributor License Agreement). Then your name will appear on the list of CLAs signed by [non-committers](https://people.apache.org/committer-index.html#unlistedclas) or [Cordova committers](http://people.apache.org/committers-by-project.html#cordova).\n\n**And don't forget to test and document your code.**\n\n\n## This documentation is generated by a tool\n\n:warning: Run `npm install` in the plugin repo to enable automatic docs generation if you plan to send a PR.  \n[jsdoc-to-markdown](https://www.npmjs.com/package/jsdoc-to-markdown) is used to generate the docs.  \nDocumentation consists of template and API docs produced from the plugin JS code and should be regenerated before each commit (done automatically via [husky](https://github.com/typicode/husky), running `npm run gen-docs` script as a `precommit` hook - see `package.json` for details).\n\n\n\n### iOS Quirks\n\nSince iOS 10 it's mandatory to add a `NSCameraUsageDescription` and `NSPhotoLibraryUsageDescription` in the info.plist.\n\n- `NSCameraUsageDescription` describes the reason that the app accesses the user’s camera.\n- `NSPhotoLibraryUsageDescription` describes the reason the app accesses the user's photo library. \n\nWhen the system prompts the user to allow access, this string is displayed as part of the dialog box. \n\nTo add this entry you can pass the following variables on plugin install.\n\n- `CAMERA_USAGE_DESCRIPTION` for `NSCameraUsageDescription`\n- `PHOTOLIBRARY_USAGE_DESCRIPTION` for `NSPhotoLibraryUsageDescription`\n\nExample:\n\n    cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION=\"your usage message\" --variable PHOTOLIBRARY_USAGE_DESCRIPTION=\"your usage message\"\n\nIf you don't pass the variable, the plugin will add an empty string as value.\n\n---\n\n# API Reference <a name=\"reference\"></a>\n\n\n* [camera](#module_camera)\n    * [.getPicture(successCallback, errorCallback, options)](#module_camera.getPicture)\n    * [.cleanup()](#module_camera.cleanup)\n    * [.onError](#module_camera.onError) : <code>function</code>\n    * [.onSuccess](#module_camera.onSuccess) : <code>function</code>\n    * [.CameraOptions](#module_camera.CameraOptions) : <code>Object</code>\n\n\n* [Camera](#module_Camera)\n    * [.DestinationType](#module_Camera.DestinationType) : <code>enum</code>\n    * [.EncodingType](#module_Camera.EncodingType) : <code>enum</code>\n    * [.MediaType](#module_Camera.MediaType) : <code>enum</code>\n    * [.PictureSourceType](#module_Camera.PictureSourceType) : <code>enum</code>\n    * [.PopoverArrowDirection](#module_Camera.PopoverArrowDirection) : <code>enum</code>\n    * [.Direction](#module_Camera.Direction) : <code>enum</code>\n\n* [CameraPopoverHandle](#module_CameraPopoverHandle)\n* [CameraPopoverOptions](#module_CameraPopoverOptions)\n\n---\n\n<a name=\"module_camera\"></a>\n\n## camera\n<a name=\"module_camera.getPicture\"></a>\n\n### camera.getPicture(successCallback, errorCallback, options)\nTakes a photo using the camera, or retrieves a photo from the device's\nimage gallery.  The image is passed to the success callback as a\nBase64-encoded `String`, or as the URI for the image file.\n\nThe `camera.getPicture` function opens the device's default camera\napplication that allows users to snap pictures by default - this behavior occurs,\nwhen `Camera.sourceType` equals [`Camera.PictureSourceType.CAMERA`](#module_Camera.PictureSourceType).\nOnce the user snaps the photo, the camera application closes and the application is restored.\n\nIf `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or\n`Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a dialog displays\nthat allows users to select an existing image.\n\nThe return value is sent to the [`cameraSuccess`](#module_camera.onSuccess) callback function, in\none of the following formats, depending on the specified\n`cameraOptions`:\n\n- A `String` containing the Base64-encoded photo image.\n- A `String` representing the image file location on local storage (default).\n\nYou can do whatever you want with the encoded image or URI, for\nexample:\n\n- Render the image in an `<img>` tag, as in the example below\n- Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.)\n- Post the data to a remote server\n\n__NOTE__: Photo resolution on newer devices is quite good. Photos\nselected from the device's gallery are not downscaled to a lower\nquality, even if a `quality` parameter is specified.  To avoid common\nmemory problems, set `Camera.destinationType` to `FILE_URI` rather\nthan `DATA_URL`.\n\n__Supported Platforms__\n\n- Android\n- BlackBerry\n- Browser\n- Firefox\n- FireOS\n- iOS\n- Windows\n- WP8\n- Ubuntu\n\nMore examples [here](#camera-getPicture-examples). Quirks [here](#camera-getPicture-quirks).\n\n**Kind**: static method of <code>[camera](#module_camera)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| successCallback | <code>[onSuccess](#module_camera.onSuccess)</code> |  |\n| errorCallback | <code>[onError](#module_camera.onError)</code> |  |\n| options | <code>[CameraOptions](#module_camera.CameraOptions)</code> | CameraOptions |\n\n**Example**  \n```js\nnavigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);\n```\n<a name=\"module_camera.cleanup\"></a>\n\n### camera.cleanup()\nRemoves intermediate image files that are kept in temporary storage\nafter calling [`camera.getPicture`](#module_camera.getPicture). Applies only when the value of\n`Camera.sourceType` equals `Camera.PictureSourceType.CAMERA` and the\n`Camera.destinationType` equals `Camera.DestinationType.FILE_URI`.\n\n__Supported Platforms__\n\n- iOS\n\n**Kind**: static method of <code>[camera](#module_camera)</code>  \n**Example**  \n```js\nnavigator.camera.cleanup(onSuccess, onFail);\n\nfunction onSuccess() {\n    console.log(\"Camera cleanup success.\")\n}\n\nfunction onFail(message) {\n    alert('Failed because: ' + message);\n}\n```\n<a name=\"module_camera.onError\"></a>\n\n### camera.onError : <code>function</code>\nCallback function that provides an error message.\n\n**Kind**: static typedef of <code>[camera](#module_camera)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| message | <code>string</code> | The message is provided by the device's native code. |\n\n<a name=\"module_camera.onSuccess\"></a>\n\n### camera.onSuccess : <code>function</code>\nCallback function that provides the image data.\n\n**Kind**: static typedef of <code>[camera](#module_camera)</code>  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| imageData | <code>string</code> | Base64 encoding of the image data, _or_ the image file URI, depending on [`cameraOptions`](#module_camera.CameraOptions) in effect. |\n\n**Example**  \n```js\n// Show image\n//\nfunction cameraCallback(imageData) {\n   var image = document.getElementById('myImage');\n   image.src = \"data:image/jpeg;base64,\" + imageData;\n}\n```\n<a name=\"module_camera.CameraOptions\"></a>\n\n### camera.CameraOptions : <code>Object</code>\nOptional parameters to customize the camera settings.\n* [Quirks](#CameraOptions-quirks)\n\n**Kind**: static typedef of <code>[camera](#module_camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| quality | <code>number</code> | <code>50</code> | Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no loss from file compression. (Note that information about the camera's resolution is unavailable.) |\n| destinationType | <code>[DestinationType](#module_Camera.DestinationType)</code> | <code>FILE_URI</code> | Choose the format of the return value. |\n| sourceType | <code>[PictureSourceType](#module_Camera.PictureSourceType)</code> | <code>CAMERA</code> | Set the source of the picture. |\n| allowEdit | <code>Boolean</code> | <code>true</code> | Allow simple editing of image before selection. |\n| encodingType | <code>[EncodingType](#module_Camera.EncodingType)</code> | <code>JPEG</code> | Choose the  returned image file's encoding. |\n| targetWidth | <code>number</code> |  | Width in pixels to scale image. Must be used with `targetHeight`. Aspect ratio remains constant. |\n| targetHeight | <code>number</code> |  | Height in pixels to scale image. Must be used with `targetWidth`. Aspect ratio remains constant. |\n| mediaType | <code>[MediaType](#module_Camera.MediaType)</code> | <code>PICTURE</code> | Set the type of media to select from.  Only works when `PictureSourceType` is `PHOTOLIBRARY` or `SAVEDPHOTOALBUM`. |\n| correctOrientation | <code>Boolean</code> |  | Rotate the image to correct for the orientation of the device during capture. |\n| saveToPhotoAlbum | <code>Boolean</code> |  | Save the image to the photo album on the device after capture. |\n| popoverOptions | <code>[CameraPopoverOptions](#module_CameraPopoverOptions)</code> |  | iOS-only options that specify popover location in iPad. |\n| cameraDirection | <code>[Direction](#module_Camera.Direction)</code> | <code>BACK</code> | Choose the camera to use (front- or back-facing). |\n\n---\n\n<a name=\"module_Camera\"></a>\n\n## Camera\n<a name=\"module_Camera.DestinationType\"></a>\n\n### Camera.DestinationType : <code>enum</code>\nDefines the output format of `Camera.getPicture` call.\n_Note:_ On iOS passing `DestinationType.NATIVE_URI` along with\n`PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will\ndisable any image modifications (resize, quality change, cropping, etc.) due\nto implementation specific.\n\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| DATA_URL | <code>number</code> | <code>0</code> | Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible |\n| FILE_URI | <code>number</code> | <code>1</code> | Return file uri (content://media/external/images/media/2 for Android) |\n| NATIVE_URI | <code>number</code> | <code>2</code> | Return native uri (eg. asset-library://... for iOS) |\n\n<a name=\"module_Camera.EncodingType\"></a>\n\n### Camera.EncodingType : <code>enum</code>\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| JPEG | <code>number</code> | <code>0</code> | Return JPEG encoded image |\n| PNG | <code>number</code> | <code>1</code> | Return PNG encoded image |\n\n<a name=\"module_Camera.MediaType\"></a>\n\n### Camera.MediaType : <code>enum</code>\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| PICTURE | <code>number</code> | <code>0</code> | Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType |\n| VIDEO | <code>number</code> | <code>1</code> | Allow selection of video only, ONLY RETURNS URL |\n| ALLMEDIA | <code>number</code> | <code>2</code> | Allow selection from all media types |\n\n<a name=\"module_Camera.PictureSourceType\"></a>\n\n### Camera.PictureSourceType : <code>enum</code>\nDefines the output format of `Camera.getPicture` call.\n_Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM`\nalong with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality\nchange, cropping, etc.) due to implementation specific.\n\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| PHOTOLIBRARY | <code>number</code> | <code>0</code> | Choose image from the device's photo library (same as SAVEDPHOTOALBUM for Android) |\n| CAMERA | <code>number</code> | <code>1</code> | Take picture from camera |\n| SAVEDPHOTOALBUM | <code>number</code> | <code>2</code> | Choose image only from the device's Camera Roll album (same as PHOTOLIBRARY for Android) |\n\n<a name=\"module_Camera.PopoverArrowDirection\"></a>\n\n### Camera.PopoverArrowDirection : <code>enum</code>\nMatches iOS UIPopoverArrowDirection constants to specify arrow location on popover.\n\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default |\n| --- | --- | --- |\n| ARROW_UP | <code>number</code> | <code>1</code> | \n| ARROW_DOWN | <code>number</code> | <code>2</code> | \n| ARROW_LEFT | <code>number</code> | <code>4</code> | \n| ARROW_RIGHT | <code>number</code> | <code>8</code> | \n| ARROW_ANY | <code>number</code> | <code>15</code> | \n\n<a name=\"module_Camera.Direction\"></a>\n\n### Camera.Direction : <code>enum</code>\n**Kind**: static enum property of <code>[Camera](#module_Camera)</code>  \n**Properties**\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| BACK | <code>number</code> | <code>0</code> | Use the back-facing camera |\n| FRONT | <code>number</code> | <code>1</code> | Use the front-facing camera |\n\n---\n\n<a name=\"module_CameraPopoverOptions\"></a>\n\n## CameraPopoverOptions\niOS-only parameters that specify the anchor element location and arrow\ndirection of the popover when selecting images from an iPad's library\nor album.\nNote that the size of the popover may change to adjust to the\ndirection of the arrow and orientation of the screen.  Make sure to\naccount for orientation changes when specifying the anchor element\nlocation.\n\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| [x] | <code>Number</code> | <code>0</code> | x pixel coordinate of screen element onto which to anchor the popover. |\n| [y] | <code>Number</code> | <code>32</code> | y pixel coordinate of screen element onto which to anchor the popover. |\n| [width] | <code>Number</code> | <code>320</code> | width, in pixels, of the screen element onto which to anchor the popover. |\n| [height] | <code>Number</code> | <code>480</code> | height, in pixels, of the screen element onto which to anchor the popover. |\n| [arrowDir] | <code>[PopoverArrowDirection](#module_Camera.PopoverArrowDirection)</code> | <code>ARROW_ANY</code> | Direction the arrow on the popover should point. |\n\n---\n\n<a name=\"module_CameraPopoverHandle\"></a>\n\n## CameraPopoverHandle\nA handle to an image picker popover.\n\n__Supported Platforms__\n\n- iOS\n\n**Example**  \n```js\nnavigator.camera.getPicture(onSuccess, onFail,\n{\n    destinationType: Camera.DestinationType.FILE_URI,\n    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,\n    popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY)\n});\n\n// Reposition the popover if the orientation changes.\nwindow.onorientationchange = function() {\n    var cameraPopoverHandle = new CameraPopoverHandle();\n    var cameraPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);\n    cameraPopoverHandle.setPosition(cameraPopoverOptions);\n}\n```\n---\n\n\n## `camera.getPicture` Errata\n\n#### Example <a name=\"camera-getPicture-examples\"></a>\n\nTake a photo and retrieve the image's file location:\n\n    navigator.camera.getPicture(onSuccess, onFail, { quality: 50,\n        destinationType: Camera.DestinationType.FILE_URI });\n\n    function onSuccess(imageURI) {\n        var image = document.getElementById('myImage');\n        image.src = imageURI;\n    }\n\n    function onFail(message) {\n        alert('Failed because: ' + message);\n    }\n\nTake a photo and retrieve it as a Base64-encoded image:\n\n    /**\n     * Warning: Using DATA_URL is not recommended! The DATA_URL destination\n     * type is very memory intensive, even with a low quality setting. Using it\n     * can result in out of memory errors and application crashes. Use FILE_URI\n     * or NATIVE_URI instead.\n     */\n    navigator.camera.getPicture(onSuccess, onFail, { quality: 25,\n        destinationType: Camera.DestinationType.DATA_URL\n    });\n\n    function onSuccess(imageData) {\n        var image = document.getElementById('myImage');\n        image.src = \"data:image/jpeg;base64,\" + imageData;\n    }\n\n    function onFail(message) {\n        alert('Failed because: ' + message);\n    }\n\n#### Preferences (iOS)\n\n-  __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.\n\n        <preference name=\"CameraUsesGeolocation\" value=\"false\" />\n\n#### Amazon Fire OS Quirks <a name=\"camera-getPicture-quirks\"></a>\n\nAmazon Fire OS uses intents to launch the camera activity on the device to capture\nimages, and on phones with low memory, the Cordova activity may be killed.  In this\nscenario, the image may not appear when the Cordova activity is restored.\n\n#### Android Quirks\n\nAndroid uses intents to launch the camera activity on the device to capture\nimages, and on phones with low memory, the Cordova activity may be killed.  In this\nscenario, the result from the plugin call will be delivered via the resume event.\nSee [the Android Lifecycle guide][android_lifecycle]\nfor more information. The `pendingResult.result` value will contain the value that\nwould be passed to the callbacks (either the URI/URL or an error message). Check\nthe `pendingResult.pluginStatus` to determine whether or not the call was\nsuccessful.\n\n#### Browser Quirks\n\nCan only return photos as Base64-encoded image.\n\n#### Firefox OS Quirks\n\nCamera plugin is currently implemented using [Web Activities][web_activities].\n\n#### iOS Quirks\n\nIncluding a JavaScript `alert()` in either of the callback functions\ncan cause problems.  Wrap the alert within a `setTimeout()` to allow\nthe iOS image picker or popover to fully close before the alert\ndisplays:\n\n    setTimeout(function() {\n        // do your thing here!\n    }, 0);\n\n#### Windows Phone 7 Quirks\n\nInvoking the native camera application while the device is connected\nvia Zune does not work, and triggers an error callback.\n\n#### Windows quirks\n\nOn Windows Phone 8.1 using `SAVEDPHOTOALBUM` or `PHOTOLIBRARY` as a source type causes application to suspend until file picker returns the selected image and\nthen restore with start page as defined in app's `config.xml`. In case when `camera.getPicture` was called from different page, this will lead to reloading\nstart page from scratch and success and error callbacks will never be called.\n\nTo avoid this we suggest using SPA pattern or call `camera.getPicture` only from your app's start page.\n\nMore information about Windows Phone 8.1 picker APIs is here: [How to continue your Windows Phone app after calling a file picker](https://msdn.microsoft.com/en-us/library/windows/apps/dn720490.aspx)\n\n#### Tizen Quirks\n\nTizen only supports a `destinationType` of\n`Camera.DestinationType.FILE_URI` and a `sourceType` of\n`Camera.PictureSourceType.PHOTOLIBRARY`.\n\n\n## `CameraOptions` Errata <a name=\"CameraOptions-quirks\"></a>\n\n#### Amazon Fire OS Quirks\n\n- Any `cameraDirection` value results in a back-facing photo.\n\n- Ignores the `allowEdit` parameter.\n\n- `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album.\n\n#### Android Quirks\n\n- Any `cameraDirection` value results in a back-facing photo.\n\n- **`allowEdit` is unpredictable on Android and it should not be used!** The Android implementation of this plugin tries to find and use an application on the user's device to do image cropping. The plugin has no control over what application the user selects to perform the image cropping and it is very possible that the user could choose an incompatible option and cause the plugin to fail. This sometimes works because most devices come with an application that handles cropping in a way that is compatible with this plugin (Google Plus Photos), but it is unwise to rely on that being the case. If image editing is essential to your application, consider seeking a third party library or plugin that provides its own image editing utility for a more robust solution.\n\n- `Camera.PictureSourceType.PHOTOLIBRARY` and `Camera.PictureSourceType.SAVEDPHOTOALBUM` both display the same photo album.\n\n- 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.\n\n#### BlackBerry 10 Quirks\n\n- Ignores the `quality` parameter.\n\n- Ignores the `allowEdit` parameter.\n\n- `Camera.MediaType` is not supported.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n#### Firefox OS Quirks\n\n- Ignores the `quality` parameter.\n\n- `Camera.DestinationType` is ignored and equals `1` (image file URI)\n\n- Ignores the `allowEdit` parameter.\n\n- Ignores the `PictureSourceType` parameter (user chooses it in a dialog window)\n\n- Ignores the `encodingType`\n\n- Ignores the `targetWidth` and `targetHeight`\n\n- `Camera.MediaType` is not supported.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n#### iOS Quirks\n\n- 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.\n\n- When using `destinationType.NATIVE_URI` and `sourceType.CAMERA`, photos are saved in the saved photo album regardless on the value of `saveToPhotoAlbum` parameter.\n\n- When using `destinationType.NATIVE_URI` and `sourceType.PHOTOLIBRARY` or `sourceType.SAVEDPHOTOALBUM`, all editing options are ignored and link is returned to original picture.\n\n#### Tizen Quirks\n\n- options not supported\n\n- always returns a FILE URI\n\n#### Windows Phone 7 and 8 Quirks\n\n- Ignores the `allowEdit` parameter.\n\n- Ignores the `correctOrientation` parameter.\n\n- Ignores the `cameraDirection` parameter.\n\n- Ignores the `saveToPhotoAlbum` parameter.  IMPORTANT: All images taken with the WP8/8 Cordova camera API are always copied to the phone's camera roll.  Depending on the user's settings, this could also mean the image is auto-uploaded to their OneDrive.  This could potentially mean the image is available to a wider audience than your app intended. If this is a blocker for your application, you will need to implement the CameraCaptureTask as [documented on MSDN][msdn_wp8_docs]. You may also comment or up-vote the related issue in the [issue tracker][wp8_bug].\n\n- Ignores the `mediaType` property of `cameraOptions` as the Windows Phone SDK does not provide a way to choose videos from PHOTOLIBRARY.\n\n[android_lifecycle]: http://cordova.apache.org/docs/en/dev/guide/platforms/android/lifecycle.html\n[web_activities]: https://hacks.mozilla.org/2013/01/introducing-web-activities/\n[wp8_bug]: https://issues.apache.org/jira/browse/CB-2083\n[msdn_wp8_docs]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006.aspx\n\n## Sample: Take Pictures, Select Pictures from the Picture Library, and Get Thumbnails <a name=\"sample\"></a>\n\nThe Camera plugin allows you to do things like open the device's Camera app and take a picture, or open the file picker and select one. The code snippets in this section demonstrate different tasks including:\n\n* Open the Camera app and [take a Picture](#takePicture)\n* Take a picture and [return thumbnails](#getThumbnails) (resized picture)\n* Take a picture and [generate a FileEntry object](#convert)\n* [Select a file](#selectFile) from the picture library\n* Select a JPEG image and [return thumbnails](#getFileThumbnails) (resized image)\n* Select an image and [generate a FileEntry object](#convert)\n\n## Take a Picture <a name=\"takePicture\"></a>\n\nBefore you can take a picture, you need to set some Camera plugin options to pass into the Camera plugin's `getPicture` function. Here is a common set of recommendations. In this example, you create the object that you will use for the Camera options, and set the `sourceType` dynamically to support both the Camera app and the file picker.\n\n```js\nfunction setOptions(srcType) {\n    var options = {\n        // Some common settings are 20, 50, and 100\n        quality: 50,\n        destinationType: Camera.DestinationType.FILE_URI,\n        // In this app, dynamically set the picture source, Camera or photo gallery\n        sourceType: srcType,\n        encodingType: Camera.EncodingType.JPEG,\n        mediaType: Camera.MediaType.PICTURE,\n        allowEdit: true,\n        correctOrientation: true  //Corrects Android orientation quirks\n    }\n    return options;\n}\n```\n\nTypically, you want to use a FILE_URI instead of a DATA_URL to avoid most memory issues. JPEG is the recommended encoding type for Android.\n\nYou take a picture by passing in the options object to `getPicture`, which takes a CameraOptions object as the third argument. When you call `setOptions`, pass `Camera.PictureSourceType.CAMERA` as the picture source.\n\n```js\nfunction openCamera(selection) {\n\n    var srcType = Camera.PictureSourceType.CAMERA;\n    var options = setOptions(srcType);\n    var func = createNewFileEntry;\n\n    navigator.camera.getPicture(function cameraSuccess(imageUri) {\n\n        displayImage(imageUri);\n        // You may choose to copy the picture, save it somewhere, or upload.\n        func(imageUri);\n\n    }, function cameraError(error) {\n        console.debug(\"Unable to obtain picture: \" + error, \"app\");\n\n    }, options);\n}\n```\n\nOnce you take the picture, you can display it or do something else. In this example, call the app's `displayImage` function from the preceding code.\n\n```js\nfunction displayImage(imgUri) {\n\n    var elem = document.getElementById('imageFile');\n    elem.src = imgUri;\n}\n```\n\nTo display the image on some platforms, you might need to include the main part of the URI in the Content-Security-Policy `<meta>` element in index.html. For example, on Windows 10, you can include `ms-appdata:` in your `<meta>` element. Here is an example.\n\n```html\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: ms-appdata: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *\">\n```\n\n## Take a Picture and Return Thumbnails (Resize the Picture) <a name=\"getThumbnails\"></a>\n\nTo get smaller images, you can return a resized image by passing both `targetHeight` and `targetWidth` values with your CameraOptions object. In this example, you resize the returned image to fit in a 100px by 100px box (the aspect ratio is maintained, so 100px is either the height or width, whichever is greater in the source).\n\n```js\nfunction openCamera(selection) {\n\n    var srcType = Camera.PictureSourceType.CAMERA;\n    var options = setOptions(srcType);\n    var func = createNewFileEntry;\n\n    if (selection == \"camera-thmb\") {\n        options.targetHeight = 100;\n        options.targetWidth = 100;\n    }\n\n    navigator.camera.getPicture(function cameraSuccess(imageUri) {\n\n        // Do something\n\n    }, function cameraError(error) {\n        console.debug(\"Unable to obtain picture: \" + error, \"app\");\n\n    }, options);\n}\n```\n\n## Select a File from the Picture Library <a name=\"selectFile\"></a>\n\nWhen selecting a file using the file picker, you also need to set the CameraOptions object. In this example, set the `sourceType` to `Camera.PictureSourceType.SAVEDPHOTOALBUM`. To open the file picker, call `getPicture` just as you did in the previous example, passing in the success and error callbacks along with CameraOptions object.\n\n```js\nfunction openFilePicker(selection) {\n\n    var srcType = Camera.PictureSourceType.SAVEDPHOTOALBUM;\n    var options = setOptions(srcType);\n    var func = createNewFileEntry;\n\n    navigator.camera.getPicture(function cameraSuccess(imageUri) {\n\n        // Do something\n\n    }, function cameraError(error) {\n        console.debug(\"Unable to obtain picture: \" + error, \"app\");\n\n    }, options);\n}\n```\n\n## Select an Image and Return Thumbnails (resized images) <a name=\"getFileThumbnails\"></a>\n\nResizing a file selected with the file picker works just like resizing using the Camera app; set the `targetHeight` and `targetWidth` options.\n\n```js\nfunction openFilePicker(selection) {\n\n    var srcType = Camera.PictureSourceType.SAVEDPHOTOALBUM;\n    var options = setOptions(srcType);\n    var func = createNewFileEntry;\n\n    if (selection == \"picker-thmb\") {\n        // To downscale a selected image,\n        // Camera.EncodingType (e.g., JPEG) must match the selected image type.\n        options.targetHeight = 100;\n        options.targetWidth = 100;\n    }\n\n    navigator.camera.getPicture(function cameraSuccess(imageUri) {\n\n        // Do something with image\n\n    }, function cameraError(error) {\n        console.debug(\"Unable to obtain picture: \" + error, \"app\");\n\n    }, options);\n}\n```\n\n## Take a picture and get a FileEntry Object <a name=\"convert\"></a>\n\nIf you want to do something like copy the image to another location, or upload it somewhere using the FileTransfer plugin, you need to get a FileEntry object for the returned picture. To do that, call `window.resolveLocalFileSystemURL` on the file URI returned by the Camera app. If you need to use a FileEntry object, set the `destinationType` to `Camera.DestinationType.FILE_URI` in your CameraOptions object (this is also the default value).\n\n>*Note* You need the [File plugin](https://www.npmjs.com/package/cordova-plugin-file) to call `window.resolveLocalFileSystemURL`.\n\nHere is the call to `window.resolveLocalFileSystemURL`. The image URI is passed to this function from the success callback of `getPicture`. The success handler of `resolveLocalFileSystemURL` receives the FileEntry object.\n\n```js\nfunction getFileEntry(imgUri) {\n    window.resolveLocalFileSystemURL(imgUri, function success(fileEntry) {\n\n        // Do something with the FileEntry object, like write to it, upload it, etc.\n        // writeFile(fileEntry, imgUri);\n        console.log(\"got file: \" + fileEntry.fullPath);\n        // displayFileData(fileEntry.nativeURL, \"Native URL\");\n\n    }, function () {\n      // If don't get the FileEntry (which may happen when testing\n      // on some emulators), copy to a new FileEntry.\n        createNewFileEntry(imgUri);\n    });\n}\n```\n\nIn the example shown in the preceding code, you call the app's `createNewFileEntry` function if you don't get a valid FileEntry object. The image URI returned from the Camera app should result in a valid FileEntry, but platform behavior on some emulators may be different for files returned from the file picker.\n\n>*Note* To see an example of writing to a FileEntry, see the [File plugin README](https://www.npmjs.com/package/cordova-plugin-file).\n\nThe code shown here creates a file in your app's cache (in sandboxed storage) named `tempFile.jpeg`. With the new FileEntry object, you can copy the image to the file or do something else like upload it.\n\n```js\nfunction createNewFileEntry(imgUri) {\n    window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function success(dirEntry) {\n\n        // JPEG file\n        dirEntry.getFile(\"tempFile.jpeg\", { create: true, exclusive: false }, function (fileEntry) {\n\n            // Do something with it, like write to it, upload it, etc.\n            // writeFile(fileEntry, imgUri);\n            console.log(\"got file: \" + fileEntry.fullPath);\n            // displayFileData(fileEntry.fullPath, \"File copied to\");\n\n        }, onErrorCreateFile);\n\n    }, onErrorResolveUrl);\n}\n```\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/apache/cordova-plugin-camera.git"
  },
  "scripts": {
    "gen-docs": "jsdoc2md --template \"jsdoc2md/TEMPLATE.md\" \"www/**/*.js\" --plugin \"dmd-plugin-cordova-plugin\" > README.md",
    "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests",
    "precommit": "npm run gen-docs && git add README.md",
    "test": "npm run jshint"
  },
  "types": "./types/index.d.ts",
  "version": "2.4.0"
}
