mosch / react-avatar-editor

Small avatar & profile picture component. Resize and crop uploaded images using a intuitive user interface.
https://react-avatar-editor.netlify.app/
MIT License
2.37k stars 369 forks source link

feature request: Provide a way to get the scaled image without refs #396

Open devth opened 1 year ago

devth commented 1 year ago

Especially in a more dynamic context where there may be more than one <AvatarEditor /> in a component it'd be very nice to be able to handle an event, or pull the scaled image data out of the existing onImageChange event instead of messing with React refs.

Maybe something like this?

                    onImageChange={({ scaledImage }) => {
                      console.log("onImageChange", {
                        scaledImage
                      });
                    }}