flyfloor / react-image-cropper

react image crop
https://braavos.me/react-image-cropper/
MIT License
174 stars 56 forks source link

crop frame maximum size option #6

Open rmeissn opened 7 years ago

rmeissn commented 7 years ago

Thank you @jerryshew for this nice and useful library!

A nice addition would be to offer an option to size the crop frame to the maximum possible size by default (respecting any ratio settings). This is currently not possible, unless I calculate the width and height myself by reimplementing some of your code outside of your library and later setting width and height for the cropper manually via the offered properties.

This could be implemented by: <cropper ... width='100%' height='100%' rate={1}> for a square cropped picture.

Or is there a workaround to achieve this feature, I haven't discovered yet?

flyfloor commented 7 years ago

@rmeissn you can create a PR.

rmeissn commented 7 years ago

I tried to read through your code, but I'm still a bit confused about the exact meaning of some variables you use. Could you add some explaining comments or change the name of some variables to more descriptive ones?

flyfloor commented 7 years ago

@rmeissn ok, i will add comments and update README, but you have to wait because recently very busy.

flyfloor commented 7 years ago

@rmeissn ok,add some comments, maximum size not intent to do, you can set width and height instand.

supromikali commented 6 years ago

@rmeissn @jerryshew Found some workaround that works just fine for me: if you set width and height to a large number that is always greater than image container, you automatically achieve max-width / max-height, for example, I set it to 999 like so:

<Cropper width={999} height={999} src={cropSrc} ref="cropper" />