Crop
裁剪图片
Repo(备用): https://github.com/jeduan/cordova-plugin-crop
Installation(安装)
1.安装Cordova和Ionic原生插件:
$ ionic cordova plugin add cordova-plugin-crop
$ npm install --save @ionic-native/crop
Supported platforms(支持平台)
Android
iOS
Usage(用法)
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)
);
Instance Members(实例成员)
裁剪图片
参数 | 类型 | 详情 |
---|---|---|
pathToImage | ||
options |
****Returns:** Promise<string>
裁剪成功返回带有新的图片地址的promise,裁剪失败返回fail