fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

.cropper-container inline styles width: 200px and height: 100px #901

Closed NicolasVanhecke closed 7 years ago

NicolasVanhecke commented 7 years ago

Why is it that the .cropper-container is always set to 200x100 px? I cannot style it so it scales properly. I can see the styles are set inline to the element itself (meaning it is set in JS?).

This is how small it looks when simply initialising the cropper without any settings. I have not added any css to interfere with anything.

screen shot 2017-06-27 at 13 21 11

MORE INFO: To be clear, I have also tried minCanvasWidth and minCanvasHeight, which partly solves the problem. I now have a bigger image, but the cropper still can't size bigger than 200x100 px.. Meaning this is not the solution (this is the max side of the cropped area, I cant drag it any bigger) screen shot 2017-06-27 at 13 31 55

fengyuanchen commented 7 years ago

Please read the docs about the minContainerWidth and minContainerHeight options:

$('img').cropper({
  minContainerWidth: 800,
  minContainerHeight: 600
})
1v commented 6 years ago

In my situation the solution was to apply cropper on image load:

$('img').load(function() {
  $('img').cropper();
});