I am trying to crop the image using Jcrop, but when I use jqueryrotate on the image, something strange happens.
I rotate the image 90, then activate JCrop, JCrop does not follow the rotation of the image, so I also rotate the Jcrop holder. The resulting image is fine, but when I select the section to crop, I noticed that my tracker is also rotated. When I drag it, it goes to the right; when I drag it to the left, it drops.
What's happening 
Then it goes
How to make the crop selection tool vertical?
My html:
<div class="img-canvas" style="background-color:#cccccc;" > <img id="image_canv" src="<?php echo $imagesource;?>"> </div>
My jQuery:
$('#rotatephoto').click(function () { value += 90; JcropAPI = $('#image_canv').data('Jcrop'); if(JcropAPI != null) { JcropAPI.destroy(); } var h = $('.img-canvas').height(); var w = $('.img-canvas').width(); $('.img-canvas').css("position","fixed"); $('.img-canvas').css("width",w); $('.img-canvas').css("height",h); $('#image_canv').Jcrop({ onSelect: showCoords2, onChange: showCoords2, setSelect: [ 0, 100, 50, 50 ] }); JcropAPI = $('#image_canv').data('Jcrop'); JcropAPI.enable(); var h2 = $('.jcrop-holder').height(); var w2 = $('.jcrop-holder').width(); if(h2 < 630) { var tempp = (630 - h2)/2; $('.jcrop-holder').css("margin-top",tempp); } if(w2 < 630) { var tempp = (630 - w2)/2; $('.jcrop-holder').css("margin-left",tempp); } $('.jcrop-holder').rotate(value); $("#image_canv").rotate(value); });
jquery image rotation crop jcrop
marchemike
source share