Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
JCrop: How to upload Image from client side in a canvas?

PS: Not a duplicate as it has multi cropping feature.

I am make a Image crop app with multiple sections cropping areas, after lot of try and research I found Jcrop useful. Now I am trying to make interface where client can upload their image by itself and then crop easily.

  • In below HTML there is static image as of now and upload button too where user can upload and replace static image in a canvas.

HTML code:

  <div style="padding:0 5%;">
<h1 style="font-family:Helvetica,sans-serif;">
  Jcrop Example <span style="color:lightgray;">- draw some crops!</span>
</h1>

<img id="target" src="https://d3o1694hluedf9.cloudfront.net/market-750.jpg">


 <div class="file btn btn-lg btn-primary">
  Upload
   <input type="file" name="file" />
 </div>
</div>

JavaScript:

  var jcp;
Jcrop.load('target').then(img => {
  jcp = Jcrop.attach(img, { multi: true });
  const rect = Jcrop.Rect.sizeOf(jcp.el);
  jcp.newWidget(rect.scale(.7, .5).center(rect.w, rect.h));
  jcp.focus();
});



function setImage(tag) {
  document.getElementById('target').src =
    'https://d3o1694hluedf9.cloudfront.net/' + tag;
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda