fengyuanchen / cropper

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

Image container strange behaviour #1056

Closed adammo14 closed 5 years ago

adammo14 commented 5 years ago

Hello,

(1) I'm experiencing an issue where uploaded image doesn't fit the image container and is roughly a third of its width. This is random as I could upload the same photo again and it would be fine. The only CSS I've overwritten for the cropper was #upload-image-container. I have set a max-height and min-width but that shouldn't matter as I've tested without it and I was getting the same result. Please see attached screenshots.

(2) I'd like my cropper-crop-box to be bigger (while retaining its aspect ratio) and I'm not sure how to do it. Could you please advise?

Screenshots (1) image

image

(2) image

Additional context cropper options

$scope.$cropper = new Cropper($scope.cropperElement, {
    aspectRatio: $scope.aspectRatio,
    dragMode: 'move',
    cropBoxMovable: false,
    cropBoxResizable: false,
    zoomOnTouch: false,
    zoomOnWheel: false,
    toggleDragModeOnDblclick: false,
    strict: true,
    disabled: true
});
fengyuanchen commented 5 years ago

Duplicate of a ton of issues.

fengyuanchen commented 5 years ago
img {
  width: 100%;
}
fengyuanchen commented 5 years ago

Don't initialize the cropper before you see the image place in the right position.