title: PHP Crops Image not as expected
body: <p>I'm trying to crop an image using <code>jcrop</code> and a <code>form</code>. When I submit the form all the required data to crop the image, aswell as the image itself, <code>POSTS</code> correctly.</p>
  
  <p>Then I'll upload the original image to the server, and store the filename along with some other data in the database. </p>
  
  <p>After that I start cropping, which does something. But not what I would expect. </p>
  
  <p>I'm trying to crop the following image: <a href="https://i.stack.imgur.com/uOzp9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uOzp9.png" alt="enter image description here"></a></p>
  
  <p>As you can see I´m trying to only crop the head off. </p>
  
  <p>When I save the image I´ll get the following as result:</p>
  
  <p><a href="https://i.stack.imgur.com/7V0ZC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7V0ZC.png" alt="enter image description here"></a></p>
  
  <p>Which as I said is not what I expected. </p>
  
  <p>This is my saving and cropping function:</p>
  
  <pre><code>function file_upload($x1, $y1, $x2, $y2, $w, $h){
              //Bestand opslaan op de server
              $filename = str_replace(' ', '', $_FILES['schilderij_toevoegen_file']['name']);
              $target  = '../Storage/portfolio/'.$filename;
              move_uploaded_file($_FILES['schilderij_toevoegen_file']['tmp_name'], $target);
  
              //Betand hercroppen
              $copy = imagecreatefromjpeg($target);
              $new = imagecreatetruecolor($w, $h);
              $size = getimagesize($target);
              imagecopyresampled($new, $copy, 0, 0, $x2, $y2, $w, $h, $size[0] * 0.5, $size[1] * 0.5);
              imagejpeg($new, '../Storage/portfolio/crp_'.$filename);
  
              print 'X1: '.$x1.', Y1: '.$y1.', X2: '.$x2.', Y2: '.$y2.', Width: '.$w.', Height: '.$h;
  
          }
  </code></pre>
  
  <p>I'm very new with this cropping function PHP has, so I would appreciate any kind of help.</p>
  
  <p>Edit: These values where used in the function above: <code>X1: 0, Y1: 115, X2: 181, Y2: 299, Width: 181, Height: 184</code> The original image size is <code>425x348</code></p>