title: Issue with imagecopy resized PHP
body: <p>I'm trying to make a web app which has an admin site where you can upload an image. I'm already using <code>imagecopy()</code> to make a square photo. But when the image is too big I'm trying to resize with <code>imagecopyresized()</code>. I've already used this code:</p>
  
  <pre><code>$file = $_FILES['img']['tmp_name'];
  $filename = $_FILES['img']['name'];
  $size = 400;
  $destino = imagecreatetruecolor($size, $size);
  list($width, $height) = getimagesize($file);
  $correction = $size / 2;
  $widths = $width / 2 - $correction;
  $heights = $height / 2 - $correction;
  $origen = imagecreatefromjpeg($file);
  $overflow = $size + 200;
  
  if($width &gt; $overflow){
      $modified = $origen;
      $ratio = $width / $height;
      $growth = $width / $overflow;
      $final = $overflow / $growth;
      if($ratio &gt; 1){
          $newwidth = $final * $ratio;
      }else{
          $newwidth = $final / $ratio;
      }
      imagecopyresized($origen, $modified, 0, 0, 0, 0, $final, $newwidth, $width, $height);
  }
  imagecopy($destino, $origen, 0, 0, $widths, $heights, $size, $size);
  </code></pre>
  
  <p>The issue here is that there's no modification to the image that is bigger than <code>$overflow</code>.</p>
  
  <p><code>$ratio</code> is to keep the original dimensions of the photos and prevent deform.</p>
  
  <p><code>$growth</code> is an index that while bigger the image is, the smallest it will be copied.</p>
  
  <p><code>$final</code> is the final width taking the growth index as a count.</p>