mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-14 04:05:23 +08:00
![Daniel Sogl](/assets/img/avatar_default.png)
* typo(barcode-scanner): fixe circle lint error * typo(docs): Unified the documentations In some plugins the typescript markup was missing. I also unified the console.log string from console.log("hello") to console.log('Hello') so any plugin page look the same.
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
|
|
|
/**
|
|
* @name Crop
|
|
* @description Crops images
|
|
* @usage
|
|
* ```typescript
|
|
* import { Crop } from '@ionic-native/crop';
|
|
*
|
|
* constructor(private crop: Crop) { }
|
|
*
|
|
* ...
|
|
*
|
|
* this.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({
|
|
pluginName: 'Crop',
|
|
plugin: 'cordova-plugin-crop',
|
|
pluginRef: 'plugins',
|
|
repo: 'https://github.com/jeduan/cordova-plugin-crop',
|
|
platforms: ['Android', 'iOS']
|
|
})
|
|
@Injectable()
|
|
export class Crop extends IonicNativePlugin {
|
|
|
|
/**
|
|
* Crops an image
|
|
* @param pathToImage
|
|
* @param options
|
|
* @returns {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
|
|
*/
|
|
@Cordova({
|
|
callbackOrder: 'reverse'
|
|
})
|
|
crop(pathToImage: string, options?: { quality: number }): Promise<string> { return; }
|
|
|
|
}
|