scottcheng / cropit

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

smallimage: stretch doesn't fill container #231

Closed andykisaragi closed 7 years ago

andykisaragi commented 7 years ago

Hi,

I'm having trouble with small images not filling the container.

My settings are:

$('.cropit-container').cropit({ imageBackground: true, imageBackgroundBorderWidth: 30, smallImage: 'stretch', minZoom: 'fill', maxZoom: 2, });

I want the image to stretch larger than it's original size to completely fill the container, but I get this:

screen shot 2017-01-18 at 14 29 00

with minZoom set to 'fit' I get this, which is what I'd expect with that setting:

screen shot 2017-01-18 at 14 27 57

Any ideas?

Thanks! x

andykisaragi commented 7 years ago

hmm actually uploading those images has made me realise that they are both similarly off-centre, it's possible some of my own CSS is interfering here...

andykisaragi commented 7 years ago

found it - my cropit is nested inside an element with text-align: center, which when combined with the various transforms, wound up with that weird offset. fixed it by putting text-align: left on the image preview container :)