Comments (4)
麻烦提供一个 demo,描述下需要实现的效果~
from antd-img-crop.
自 0.6.0 版本起,beforeUpload 检测移到了裁剪图片之前,可以先检测文件是否过大了。
from antd-img-crop.
自 0.6.0 版本起,beforeUpload 检测移到了裁剪图片之前,可以先检测文件是否过大了。
beforeUpload 检测前移,带来了新的问题:
大部分图片上传大小限制,只是想限制裁剪之后的大小,而不是裁剪之前的
如果想允许用户选择大尺寸图片,裁剪之后再判断所生成图片的大小是否符合要求,怎么实现呢?
建议:
新增一个 props 如 beforeOK,用来执行“裁剪之后、上传之前”的检测操作,在 onOK 中 this.resolve(newFile) 之前调用
如果需要,我可以提交pr
from antd-img-crop.
@zhoujingsai
谢谢建议~
欢迎 PR。
经考虑,希望能将 beforeUpload
的检测时机还原为之前的情况,也就是裁剪后、上传前检测。
这是之前的代码:https://github.com/nanxiaobei/antd-img-crop/blob/d524530bac1adc367a53d880b65cee3466bc0a1b/src/index.jsx
然后为 ImgCrop 组件增加一个属性 beforeCrop
,用于执行裁剪前的检测。
谢谢~
from antd-img-crop.
Related Issues (20)
- Image crop modal not following antd theme HOT 1
- 裁剪宽高问题、升级 antd 报错问题 HOT 1
- [Feature Request] - Reset Button HOT 1
- Bug: beforeUpload返回了Upload.LIST_IGNORE依然会触发onChange HOT 1
- 缩小按钮无法使用 HOT 1
- 某些情况下组件使用了rem单位,样式混乱 HOT 1
- 怎么实现限制非png文件上传时不显示裁剪弹窗并且忽略上传文件 HOT 1
- Issue with Tailwindcss HOT 3
- Module not found: Error: Can't resolve 'antd/lib/version/style' in '/Users/vcp/IdeaProjects/therapydesigner/02_Software/TherapyManager/frontend/node_modules/antd-img-crop/dist' HOT 2
- 点了取消按钮,图片还是会加入到文件列表中,并且还执行了上传操作,但是没有经过 beforeUpload 钩子 HOT 6
- 偶发性存在弹窗出来不显示裁剪框的情况 HOT 6
- 裁剪功能,在antdesign官网中的例子,如果上传的是png图片,裁减之后会自动加上白底 HOT 1
- maxAspect and minAspect HOT 1
- 关于受控的文件列表 HOT 1
- The image has lost its transparent background HOT 2
- useless Ok button when using tailwindcss HOT 1
- TS error TS2322 Type '{ children: Element }' is not assignable to type 'IntrinsicAttributes & ImgCropProps'. Property 'children' does not exist on type 'IntrinsicAttributes & ImgCropProps'. HOT 1
- When crop a gif, it convert it to static picture HOT 1
- Upgrade dept
- Show crop modal only for case when image did not pass validation HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antd-img-crop.