English | 简体ä¸æ–‡
An image cropper for Ant Design Upload.
https://codesandbox.io/s/4qoom5p9x4
yarn add antd-img-crop
import ImgCrop from 'antd-img-crop';
import { Upload } from 'antd';
const Demo = () => (
<ImgCrop>
<Upload>+ Add image</Upload>
</ImgCrop>
);
type: number
, default: 100
Crop width in px
. If useRatio
is true
, it'll be ratio.
type: number
, default: 100
Crop height in px
. If useRatio
is true
, it'll be ratio.
type: boolean
, default: false
If use width
and height
as ratio, not real px
. And crop will fill the width or height.
e.g. width={500} height={400}
and width={5} height={4}
are exactly the same.
type: boolean
, default: true
If crop can resize.
type: boolean
, default: true
If crop can resize and drag.
type: string
, default: "Edit image"
Modal title.
type: number
, default: 520
Modal width in px
.
type: function
, default: -
Execute before crop, if return false
, modal will not open. (Not support Promise
)
Ant Design Upload beforeUpload
prop will execute after crop, before upload.