title: Cropping a profile picture in Node JS
body: <p>I want the user on my site to be able to crop an image that they will use as a profile picture. I then want to store this image in an <code>uploads</code> folder on my server.</p>
  
  <p>I've done this using php and the JCrop plugin, but I've recently started to change the framework of my site to use Node JS.</p>
  
  <p>This is how I allowed the user to crop an image before using JCrop:</p>
  
  <pre><code> $("#previewSub").Jcrop({
       onChange: showPreview,
       onSelect: showPreview,
       aspectRatio: 1, 
       setSelect: [0,imgwidth+180,0,0],
       minSize: [90,90],
       addClass: 'jcrop-light' 
       }, function () {
           JcropAPI = this;
       });
  </code></pre>
  
  <p>and I would use php to store it in a folder:</p>
  
  <pre><code>&lt;?php
  
  $targ_w = $targ_h = 300;
  $jpeg_quality = 90;
  
  $img_r = imagecreatefromjpeg($_FILES['afile']['tmp_name']);
  $dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
  
  imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
  $targ_w,$targ_h,$_POST['w'],$_POST['h']);
  
  header("Content-type: image/jpeg");
  imagejpeg($dst_r,'uploads/sample3.jpg', $jpeg_quality);
  ?&gt;
  </code></pre>
  
  <p>Is there an equivalent plugin to JCrop, as shown above, using Node JS? There are probably multiple ones, if there are, what ones would you recommend? Any simple examples are appreciated too.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Because the question is not getting any answers, perhaps it is possible to to keep the JCrop code above, and maybe change my php code to Node JS. If this is possible, could someone show me how to translate my php code, what would would be the equivalent to php above?</p>
  
  <p>I am very new to Node, so I'm having a difficult time finding the equivalent functions and what not.</p>