Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
upload multiple images with crop modal using croppie js
// Start upload preview image
$(".gambar").attr("src", "assets/img/addimg.png");
var $uploadCrop,
  tempFilename,
  rawImg,
  imageId;

function readFile(input) {
  if (input.files && input.files[0]) {
    var reader = new FileReader();
    reader.onload = function(e) {
      $('.upload-demo').addClass('ready');
      $('#cropImagePop').modal('show');
      rawImg = e.target.result;
    }
    reader.readAsDataURL(input.files[0]);
  } else {
    swal("Sorry - you're browser doesn't support the FileReader API");
  }
}

$uploadCrop = $('#upload-demo').croppie({
  viewport: {
    width: 150,
    height: 150,
  },
  enforceBoundary: false,
  enableExif: true
});
$('#cropImagePop').on('shown.bs.modal', function() {
  // alert('Shown pop');
  $uploadCrop.croppie('bind', {
    url: rawImg
  }).then(function() {
    console.log('jQuery bind complete');
  });
});

$('.item-img').on('change', function() {
  imageId = $(this).data('id');
  tempFilename = $(this).val();
  $('#cancelCropBtn').data('id', imageId);
  readFile(this);
});
$('#cropImageBtn').on('click', function(ev) {
  $uploadCrop.croppie('result', {
    type: 'base64',
    format: 'jpeg',
    size: {
      width: 150,
      height: 150
    }
  }).then(function(resp) {
    $('#item-img-output').attr('src', resp);
    $('#cropImagePop').modal('hide');
  });
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!