Foliotek / Croppie

A Javascript Image Cropper
http://foliotek.github.io/Croppie
MIT License
2.56k stars 885 forks source link

🙏Feature request: add a method for change viewport size #726

Open vihatsoft opened 4 years ago

vihatsoft commented 4 years ago

Hello, Thank for nice library. but one most important feature is missing. can't change view port size after bind image. Please add a method to change the viewport size at runtime using custom width height. 🙏 Thank you,

pkjindal111 commented 3 years ago

Yes, this is an important feature, please add this method.

Here's my small trick i used, i want to share, may help others.

So, my problem was i wanted to upload banner and logo on same page, both required different viewport, but cant create 2 instances of croppie and nor can modify viewport so what i did is when file input field is changed, i added an class to the crop wrapper (banner, logo), based on class i modified the css, the width and height for viewport, and it worked perfectly!