Recortando imagem
Preparando a foto!
<img type="image" name="deusllene_2" style="width: 50px">
<input type="file" name="item_foto" id="item_foto" accept="image/*" />
<div class="col-md-4" id="carvalho" style="width:350px; margin-top:30px"></div>
<button type="submit" name="up">envair</button>
</form>
<br />
<div id="store_image"></div>
</div>
</div>
×
Posicione sua imagem
–>
Recortar a imagem
$(document).ready(function() {
$image_crop = $(‘#image_demo’).croppie({
enableExif: true,
viewport: {
width: 183,
height: 230,
type: ‘square’ //
},
boundary: {
width: 300,
height: 300
}
});
$(‘#item_foto’).on(‘change’, function() {
var reader = new FileReader();
reader.onload = function(event) {
$image_crop.croppie(‘bind’, {
url: event.target.result
}).then(function() {
console.log(‘jQuery bind complete’);
});
}
reader.readAsDataURL(this.files(0));
$(‘#insertimageModal’).modal(‘show’);
});
$(‘.crop_image’).click(function(event) {
$( ‘#deusllene’ ).remove();
$image_crop.croppie(‘result’, {
type: ‘canvas’,
size: ‘viewport’
}).then(function(response) {
var formData = response;
$(‘#insertimageModal’).modal(‘hide’);
$( “#carvalho” ).append(”)
formData.readAsDataURL(this.files(0));
});
});
});