title: JCrop resizing the image not cropping - Javascript
body: <p>I am trying to use JCrop to crop an image. However the results are frustratingly wrong and I am not sure why. I have an image uploader that when someone selects in image a javascript changes the source of an image already on the page to match the newly upload image. I then have this code:</p>
  
  <pre><code>$('#myForm').ajaxForm({
      dataType: 'json',
      success: function (result) {
          $("#image-editor-preview img")
              .attr("src", "/Profiles/AvatarWorker/" + _id + "?random=" + Math.random())
                          .Jcrop({
                              aspectRatio: 1,
                              setSelect: [100, 100, 50, 50],
                              minSize: [160, 160],
                              maxSize: [160, 160],
                              onChange: setCoords,
                              onSelect: setCoords
                          });
      }
  });
  
  var x = 0, y = 0, w = 0, h = 0;
  function setCoords(c) {
      x = c.x;
      y = c.y;
      w = c.w;
      h = c.h;
  };
  </code></pre>
  
  <p>However this is what happens:</p>
  
  <p><img src="https://i.stack.imgur.com/1CXSf.png" alt="enter image description here"></p>
  
  <p>I have tried tried quite a bit to fix this but the end results are ALWAYS the same. Anyone have any ideas? Thanks.</p>