You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| width | 0 | Both | Defines the desired width (in device independent pixels) of the taken image. It should be used with height property. If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image. The actual image width will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions). |
46
-
| height | 0 | Both | Defines the desired height (in device independent pixels) of the taken image. It should be used with width property. If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image. The actual image height will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions). |
45
+
| width | 0 | Both | Defines the desired width (in device independent pixels) of the taken image. It should be used with `height` property. If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image. The actual image width will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions). |
46
+
| height | 0 | Both | Defines the desired height (in device independent pixels) of the taken image. It should be used with `width` property. If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image. The actual image height will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions). |
47
47
| keepAspectRatio | true | Both | Defines if camera picture aspect ratio should be kept during picture resizing. This property could affect width or height return values. |
48
48
| saveToGallery | true | Both | Defines if camera picture should be copied to photo Gallery (Android) or Photos (iOS) |
49
49
| allowsEditing | false | iOS | Defines if camera "Retake" or "Use Photo" screen forces the user to crop camera picture to a square and optionally lets them zoom in. |
50
-
| cameraFacing | rear | Both | The initial camera facing. Use 'front' for selfies. |
50
+
| cameraFacing | rear | Both | The initial camera facing. Use `'front'` for selfies. |
51
51
52
52
53
53
> Note: The `saveToGallery` option might have unexpected behavior on Android! Some vendor camera apps (e.g. LG) will save all captured images to the gallery regardless of what the value of `saveToGallery` is. This behavior cannot be controlled by the camera plugin and if you must exclude the captured image from the photo gallery, you will need to get a local storage read/write permission and write custom code to find the gallery location and delete the new image from there.
@@ -60,14 +60,14 @@ Both Android and iOS require explicit permissions in order for the application t
60
60
61
61
```JavaScript
62
62
camera.requestPermissions().then(
63
-
functionsuccess() {
64
-
// permission request accepted or already granted
65
-
// ... call camera.takePicture here ...
66
-
},
67
-
functionfailure() {
68
-
// permission request rejected
69
-
// ... tell the user ...
70
-
}
63
+
functionsuccess() {
64
+
// permission request accepted or already granted
65
+
// ... call camera.takePicture here ...
66
+
},
67
+
functionfailure() {
68
+
// permission request rejected
69
+
// ... tell the user ...
70
+
}
71
71
);
72
72
```
73
73
@@ -84,23 +84,28 @@ function failure() {
84
84
85
85
### Using the camera module to take a picture
86
86
87
-
Using the camera module is relatively simple.
87
+
Using the camera module is relatively simple.
88
88
However, there are some points that need a little bit more explanation.
89
89
90
90
In order to use the camera module, just require it, as shown in Example 1:
91
91
92
92
> Example 1: Require camera module in the application
93
-
```JavaScript
94
-
var camera =require("nativescript-camera");
93
+
```JavaScript
94
+
// JavaScript
95
+
constcamera=require("nativescript-camera");
95
96
```
96
-
```TypeScript
97
+
98
+
```TypeScript
99
+
// TypeScript
97
100
import*ascamerafrom"nativescript-camera";
98
101
```
99
102
100
103
Then you are ready to use it:
101
104
> Example 2: How to take a picture and to receive image asset
102
-
```JavaScript
103
-
var imageModule =require("tns-core-modules/ui/image");
This could be used to create thumbnails for quick display within your application.
@@ -196,15 +221,17 @@ The first thing that the developers should check if the device has an available
196
221
The method isAvaiable will return true if the camera hardware is ready to use or false if otherwise.
197
222
198
223
```
199
-
var isAvailable = camera.isAvailable();
224
+
const isAvailable = camera.isAvailable();
200
225
```
201
226
202
227
> Note: This method will return false when used in iOS simulator (as the simulator does not have camera hardware)
203
228
204
229
## Contribute
230
+
205
231
We love PRs! Check out the [contributing guidelines](CONTRIBUTING.md). If you want to contribute, but you are not sure where to start - look for [issues labeled `help wanted`](https://github.com/NativeScript/nativescript-camera/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
206
232
207
-
## Get Help
233
+
## Get Help
234
+
208
235
Please, use [github issues](https://github.com/NativeScript/nativescript-camera/issues) strictly for [reporting bugs](CONTRIBUTING.md#reporting-bugs) or [requesting features](CONTRIBUTING.md#requesting-new-features). For general questions and support, check out [Stack Overflow](https://stackoverflow.com/questions/tagged/nativescript) or ask our experts in [NativeScript community Slack channel](http://developer.telerik.com/wp-login.php?action=slack-invitation).
0 commit comments