Coder Social home page Coder Social logo

Comments (4)

nanxiaobei avatar nanxiaobei commented on May 23, 2024

麻烦提供一个 demo,描述下需要实现的效果~

from antd-img-crop.

nanxiaobei avatar nanxiaobei commented on May 23, 2024

自 0.6.0 版本起,beforeUpload 检测移到了裁剪图片之前,可以先检测文件是否过大了。

from antd-img-crop.

zhoujingsai avatar zhoujingsai commented on May 23, 2024

自 0.6.0 版本起,beforeUpload 检测移到了裁剪图片之前,可以先检测文件是否过大了。

beforeUpload 检测前移,带来了新的问题:
大部分图片上传大小限制,只是想限制裁剪之后的大小,而不是裁剪之前的
如果想允许用户选择大尺寸图片,裁剪之后再判断所生成图片的大小是否符合要求,怎么实现呢?

建议:
新增一个 props 如 beforeOK,用来执行“裁剪之后、上传之前”的检测操作,在 onOK 中 this.resolve(newFile) 之前调用

如果需要,我可以提交pr

from antd-img-crop.

nanxiaobei avatar nanxiaobei commented on May 23, 2024

@zhoujingsai
谢谢建议~
欢迎 PR。

经考虑,希望能将 beforeUpload 的检测时机还原为之前的情况,也就是裁剪后、上传前检测。
这是之前的代码:https://github.com/nanxiaobei/antd-img-crop/blob/d524530bac1adc367a53d880b65cee3466bc0a1b/src/index.jsx

然后为 ImgCrop 组件增加一个属性 beforeCrop,用于执行裁剪前的检测。

谢谢~

from antd-img-crop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.