title: Why does my Image stretch when I crop it?
body: <p>I am using the following code snippet in order to crop a image?</p>
  
  <pre><code>   function crop($width,$height) {
         $new_image = imagecreatetruecolor($width, $height);
         imagecopyresampled($new_image, $this-&gt;image, 0, 0, 0, 0, $this-&gt;getWidth(), $this-&gt;getHeight(), $width, $height );
         $this-&gt;image = $new_image;
     }
  </code></pre>
  
  <p>Here, <code>$this-&gt;image</code> is the original image <code>$this-&gt;getWidth()</code> and <code>$this-&gt;getHeight()</code> holds the original dimensions of the picture, where as <code>$width</code> and <code>$height</code>, is the crop area.</p>
  
  <p>But for some reason, the crop image is resized(we can almost say it is resized).</p>
  
  <p>How to fix this?</p>