1
1
<!--
2
2
@Author: Brian Thurlow <bthurlow>
3
3
@Date: 03/29/2016 03:41:05 PM
4
- @Last modified by: bthurlow
5
- @Last modified time: 03/29 /2016 04:24:04 PM
4
+ @Last modified by: Brian Thurlow
5
+ @Last modified time: 04/01 /2016 11:52:29 AM
6
6
-->
7
7
8
-
9
-
10
8
# A {N} Image Cropping Plugin
11
- [ ![ License] ( https://img.shields.io/badge/License-MIT-blue.svg?style=flat )] ( http://choosealicense.com/licenses/mit/ )
12
- [ ![ npm] ( https://img.shields.io/npm/v/nativescript-imagecropper.svg )] ( https://www.npmjs.com/package/nativescript-imagecropper )
13
- [ ![ npm] ( https://img.shields.io/npm/dt/nativescript-imagecropper.svg?label=npm%20downloads )] ( https://www.npmjs.com/package/nativescript-imagecropper )
14
- [ ![ GitHub release] ( https://img.shields.io/github/release/bthurlow/nativescript-imagecropper.svg )] ( https://github.com/bthurlow/nativescript-imagecropper )
9
+
10
+ [ ![ License] ( https://img.shields.io/badge/License-MIT-blue.svg?style=flat )] ( http://choosealicense.com/licenses/mit/ ) [ ![ npm] ( https://img.shields.io/npm/v/nativescript-imagecropper.svg )] ( https://www.npmjs.com/package/nativescript-imagecropper ) [ ![ npm] ( https://img.shields.io/npm/dt/nativescript-imagecropper.svg?label=npm%20downloads )] ( https://www.npmjs.com/package/nativescript-imagecropper ) [ ![ GitHub release] ( https://img.shields.io/github/release/bthurlow/nativescript-imagecropper.svg )] ( https://github.com/bthurlow/nativescript-imagecropper )
15
11
16
12
## Notes
17
13
18
14
iOS 8+
19
15
20
16
Android 17+
21
17
22
- ###Based on
18
+ ### Based on
19
+
23
20
[ TOCropViewController] ( https://github.com/TimOliver/TOCropViewController ) for iOS
24
21
25
22
[ uCrop] ( https://github.com/Yalantis/uCrop ) for Android
@@ -28,11 +25,12 @@ Android 17+
28
25
29
26
Run ` tns plugin add nativescript-imagecropper `
30
27
31
- ## Android Install Notes
28
+ ### Android Install Notes
32
29
33
30
This plugin is designed according to {N} 2.0 Specs. For Android, you will need to modify the AndroidManifest.xml file.
34
31
35
32
Add the following to the AndroidManifest.xml
33
+
36
34
``` xml
37
35
<manifest >
38
36
<application >
@@ -44,12 +42,15 @@ Add the following to the AndroidManifest.xml
44
42
### Usage
45
43
46
44
To use the image cropping module you must first require it.
45
+
47
46
``` js
48
47
var icModule = require (" nativescript-imagecropper" );
49
48
```
49
+
50
50
### Methods
51
51
52
- show(ImageSource): Returns a cropped ImageSource
52
+ ` show(ImageSource) ` : Returns a cropped ImageSource
53
+
53
54
``` js
54
55
var cropper = new icModule.ImageCropper ();
55
56
cropper .show (picture).then (function (args ){
@@ -60,7 +61,8 @@ cropper.show(picture).then(function(args){
60
61
});
61
62
```
62
63
63
- show(ImageSource,Options): Returns a cropped and resized ImageSource
64
+ ` show(ImageSource,Options) ` : Returns a cropped and resized ImageSource
65
+
64
66
``` js
65
67
var cropper = new icModule.ImageCropper ();
66
68
cropper .show (picture,{width: 300 ,height: 300 }).then (function (args ){
@@ -72,13 +74,15 @@ cropper.show(picture,{width:300,height:300}).then(function(args){
72
74
```
73
75
74
76
### Options
75
- * width:<number > The width of the image you would like returned.
76
- * height:<number > The height of the image you would like returned.
77
+
78
+ Option | Type | Description
79
+ ------ | ------ | ------------------------------------------------
80
+ width | number | The width of the image you would like returned.
81
+ height | number | The height of the image you would like returned.
77
82
78
83
### Returned Result Arguments
79
- * response: string;
80
- * Success
81
- * Cancelled
82
- * Error
83
- * image: ImageSource;
84
- * Returns null if there was an error or was cancelled.
84
+
85
+ Argument | Type | Result(s)
86
+ -------- | ----------- | --------------------------------------------------------------------------
87
+ response | string | Success<br />Cancelled<br />Error
88
+ image | ImageSource | ` null ` if there was an error or was cancelled<br />` ImageSource ` on success
0 commit comments