HondaTypeR / antd-img-crop

🔪 An image cropper for Ant Design Upload

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

antd-img-crop

An image cropper for Ant Design Upload.

npm npm npm bundle size GitHub

English | 简体中文

Demo

Edit antd-img-crop

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.
useRatio - - Deprecated, please use contain.
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 - Execute before crop, modal will not open if return false (Not support Promise). beforeUpload prop of Upload will execute after crop, before upload.

new File error? try jimmywarting/FormData#11 (comment)

License

MIT License (c) nanxiaobei

About

🔪 An image cropper for Ant Design Upload

License:MIT License


Languages

Language:JavaScript 97.4%Language:CSS 2.6%