react-images-uploading icon indicating copy to clipboard operation
react-images-uploading copied to clipboard

[Feature Request] Multiple validation rules required

Open sanishkr opened this issue 4 years ago • 7 comments

Thanks for making this module. I am curious, if there's a way to implement this:

  • ratio : (resolutionMinWidth / resolutionMinHeight) === (image width / image height)
  • min Dimensions: image's width > resolutionMinWidth && image's height > resolutionMinHeight

I need both of these validations together. Thanks in Advance

sanishkr avatar Jan 12 '22 10:01 sanishkr

Hi @sanishkr, Currently, the lib just supports only one type of validation on init. So maybe we should make resolutionType accept string[] type that could support your case. Btw we still do not have the plan to do this now, I would appreciate it if you can do a pull request for it. Welcome~ Thank you, hope you doing well!

vutoan266 avatar Jan 13 '22 15:01 vutoan266

Thanks for the quick reply. Will make a PR and let you know.

sanishkr avatar Jan 14 '22 06:01 sanishkr

@vutoan266 I have added 2 separate PRs for 2 possible solutions. #115 and #116 Please have a look at them and make naming changes if required as per your convenience.

Thanks

sanishkr avatar Jan 14 '22 11:01 sanishkr

Hi @sanishkr, Thanks for your enthusiasm and nice try, good job bro!! I took a look 2 pull requests and prefer resolutionType can accept an array of enums: https://github.com/vutoan266/react-images-uploading/pull/115 Your implementation is good. Btw I have commented on it for some suggestions, can discuss more if you have any concerns. I will merge it when the code looks better (update document also), mark you as a contributor. Thank you so much again :D

vutoan266 avatar Jan 14 '22 16:01 vutoan266

Hi @vutoan266,

I have updated the readme as you asked. Also, I do not see any comments on the PR #115

sanishkr avatar Jan 17 '22 07:01 sanishkr

Cool!! You can see my comments under Conversation tab of pull request page.

vutoan266 avatar Jan 17 '22 13:01 vutoan266

@vutoan266 https://github.com/vutoan266/react-images-uploading/pull/115#issuecomment-1014689946

sanishkr avatar Jan 17 '22 16:01 sanishkr