scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
875 stars 304 forks source link

how can I pass an imgState and options? #254

Open ryanmstokes opened 7 years ago

ryanmstokes commented 7 years ago

I want to pass an image rather than use the input and this works fine for me:

$('#image-cropper').cropit('imageSrc', '/images//images/banner.jpg')

but it seems from the documentation that if you want to pass options aswell as this you need to use imageState? I saw this mentioned in the docs and in an answer here but I cant for the life of me get this to work:

$('#image-cropper').cropit({ imageBackground: true, imageBackgroundBorderWidth: 20, imageState: { src: '/images/banner.jpg' , }, });

this doesnt work either:

$('#image-cropper').cropit({ imageState: { src: '/images/banner.jpg' , }, });

What am I doing wrong and why is one ImageSrc and the other imageState?

Thanks in advance!

Rade0nFighter commented 6 years ago

$('#image-cropper').cropit({ imageState: { src: 'blank.png' , }, smallImage: 'allow' });

Seems to work with latest version