-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image inside the cropper in a Bootstrap modal not centered and too small #339
Comments
I have added autoCropArea: 1 and problem is fixed. |
Ok, no. The problem continues. More info about the problem: var cropper = new Cropper(document.getElementById(imageId), {
viewMode: 1,
aspectRatio: 4/3,
responsive: true,
guides: false,
zoomable: false,
autoCropArea: 1,
movable: false,
scalable: false,
ready: function () {
var self = this;
$imageModal.find('#save-image').one('click', function (event) {
$imageModal.modal('hide');
var b64Img = self.cropper
.getCroppedCanvas({ width: 800, height: 600 })
.toDataURL('image/png');
if (parseInt(imgId) === 1) {
fileUploader.featuredImage = b64Img;
fileUploader.numImagesSelected++;
} else {
fileUploader.images.push(b64Img);
fileUploader.numImagesSelected++;
}
$imagePreviewer.parent().removeClass('hidden').prev().addClass('hidden');
$imagePreviewer.css('background-image', 'url('+ b64Img +')');
});
}
}); What is happening? |
Please place your image correctly first before use the cropper on it. |
Ok, thank you for your help. It worked. |
What do you mean by this? I think that I am experiencing the same issue, however I don't think I've placed the image 'incorrectly' on the dom. @fengyuanchen @SiroDiaz |
@123epsilon I mean:
|
I'm trying to load my cropper component to my modal and the image has loaded along with the cropper component except that I cannot set size to the image and it's rather too small to work on it (like in @SiroDiaz 's screenshot) component.html
image-cropper.component.html I've tried various options but nothing worked. |
I've finally managed to sort out the issue by adding an if loop around my image component and loaded the image after loading my modal with set timeout. image-cropper.component.html
component.ts
|
I found the answer to this question on this issue: |
I am loading a base 64 image from a input file and when i show the modal, the cropper shows wrong (at the top left margin and small) the image and i can't move the cropper area in all the editor.
I have tried with png and jpg images and the same bug. I attach you screenshots
![captura de pantalla 2018-04-16 a las 13 01 51](https://user-images.githubusercontent.com/7469286/38805733-41c61b4e-4177-11e8-8e9a-6295f06c5ae7.png)
![captura de pantalla 2018-04-16 a las 13 02 02](https://user-images.githubusercontent.com/7469286/38805734-41ef002c-4177-11e8-936f-fa76f55f78f9.png)
The text was updated successfully, but these errors were encountered: