awesome-cordova-plugins/src/plugins/crop.ts

36 lines
870 B
TypeScript
Raw Normal View History

import { Cordova, Plugin } from './plugin';
2016-07-29 00:45:37 +08:00
/**
* @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({
pluginName: 'Crop',
2016-07-29 00:45:37 +08:00
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; }
}