1.0.1 • Published 4 years ago
jk-clip v1.0.1
antd-img-crop
An image cropper for Upload of Ant Design.
English | 简体中文
Demo
Install
yarn add antd-img-crop
Usage
import ImgCrop from 'antd-img-crop';
import { Upload } from 'antd';
const Demo = () => (
<ImgCrop>
<Upload>+ Add image</Upload>
</ImgCrop>
);
Props
Name | Type | Default | Description |
---|---|---|---|
width | number | 100 | Width of cropped image in px |
height | number | 100 | Height of cropped image in px |
contain | boolean | false | Consistent with background-size: contain , crop area will fill the width or height |
resize | boolean | true | If crop area can resize |
resizeAndDrag | boolean | true | If crop area can resize and drag |
modalTitle | string | 'Edit image' | Title of modal |
modalWidth | number | 520 | Width of modal in px |
beforeCrop | function | - | If return false , modal will not open. Call order: beforeCrop → crop → beforeUpload → upload |
rotate | boolean | false | If image can rotate |
rotateLabel | string | 'Rotate' | Rotate label |
new File
error? try https://github.com/jimmywarting/FormData/issues/11#issuecomment-277522987