Skip to content
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

How to resize image to fit all the aspect ratio using jCrop? #285

Open
cesarodriguez4 opened this issue Nov 16, 2018 · 1 comment
Open

Comments

@cesarodriguez4
Copy link

I'm using Jcrop for resizing an image with aspect ratio 1. For most cases works well, however in some cases when the image is widther I can't select all the image. What kind of action can I do for select the whole content of the image?

captura realizada el 2018-11-16 12 45 26

I tried to add some zoom implementations I looked in the web however the zoom affects the area of selection and the result is the same. I need to be able to select all the content of the image.

function readURL(input) {
if (input.files && input.files[0]) {
  var reader = new FileReader();
  reader.onload = function(e) {
    $('#jimage').attr('src', e.target.result);
  }

  reader.readAsDataURL(input.files[0]);
     $('#jimage').Jcrop({
        onSelect:    showCoords,
        aspectRatio: 1,
        bgColor:     '#2e7cce',
        bgOpacity:   .4,
        boxWidth: 500,
    });
}}
@pixi
Copy link

pixi commented Nov 20, 2018

Set the "aspectRatio: 0" and you can select whatever you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants