Skip to content

Commit

Permalink
feat(crop): add crop plugin (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Jul 28, 2016
1 parent 2c9245c commit 41c9adf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {CameraPreview} from './plugins/camera-preview';
import {CardIO} from './plugins/card-io';
import {Clipboard} from './plugins/clipboard';
import {Contacts} from './plugins/contacts';
import {Crop} from './plugins/crop';
import {DatePicker} from './plugins/datepicker';
import {DBMeter} from './plugins/dbmeter';
import {Deeplinks} from './plugins/deeplinks';
Expand Down Expand Up @@ -123,6 +124,7 @@ export {
BluetoothSerial,
CameraPreview,
Clipboard,
Crop,
DBMeter,
Deeplinks,
DeviceAccounts,
Expand Down Expand Up @@ -180,6 +182,7 @@ window['IonicNative'] = {
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
Expand Down
34 changes: 34 additions & 0 deletions src/plugins/crop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {Cordova, Plugin} from './plugin';
/**
* @name Crop
* @description Crops images
* @usage
* ```
* import {Crop} from 'ionic-native';
*
* ...
*
* Crop.crop('path/to/image.jpg', {quality: 75})
* .then(
* newImage => console.log("new image path is: " + newImage),
* error => console.error("Error cropping image", error)
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-crop',
pluginRef: 'plugins',
repo: 'https://github.com/jeduan/cordova-plugin-crop'
})
export class Crop {
/**
* Crops an image
* @param pathToImage
* @param options
* @return {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
*/
@Cordova({
callbackOrder: 'reverse'
})
static crop(pathToImage: string, options?: {quality: number}): Promise<string> {return; }
}

0 comments on commit 41c9adf

Please sign in to comment.