1.0.4 • Published 3 years ago

antd-img-edit v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

develope base on https://www.npmjs.com/package/antd-img-crop I add the functionality of mirror the image

antd-img-edit

Install

yarn add antd-img-edit

Usage

import ImgCrop from 'antd-img-edit';
import { Upload } from 'antd';

const Demo = () => (
  <ImgCrop flip rotate>
    <Upload>+ Add image</Upload>
  </ImgCrop>
);

Props

PropTypeDefaultDescription
aspectnumber1 / 1Aspect of crop area , width / height
shapestring'rect'Shape of crop area, 'rect' or 'round'
gridbooleanfalseShow grid of crop area (third-lines)
qualitynumber0.4Image quality, 0 ~ 1
fillColorstringwhiteFill color when cropped image smaller than canvas
zoombooleantrueEnable zoom for image
flipbooleantrueenable horizontal flip and vertical flip of image
rotatebooleanfalseEnable rotate for image
minZoomnumber1Minimum zoom factor
maxZoomnumber3Maximum zoom factor
modalTitlestring'Edit image'Title of modal
modalWidthnumber | string520Width of modal in pixels number or percentages
modalOkstring'OK'Text of confirm button of modal
modalCancelstring'Cancel'Text of cancel button of modal
beforeCropfunction-Call before modal open, if return false, it'll not open
cropperPropsobject-Props of react-easy-crop (* existing props cannot be overridden)

Styles

To prevent overwriting the custom styles to antd, antd-img-edit does not import the style files of components.

Therefore, if your project configured babel-plugin-import, and not use Modal or Slider, you need to import the styles yourself:

import 'antd/es/modal/style';
import 'antd/es/slider/style';

License

MIT License (c) nanxiaobei