I am using the following code snippet in order to crop a image?
function crop($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $this->getWidth(), $this->getHeight(), $width, $height );
$this->image = $new_image;
}
Here, $this->image
is the original image $this->getWidth()
and $this->getHeight()
holds the original dimensions of the picture, where as $width
and $height
, is the crop area.
But for some reason, the crop image is resized(we can almost say it is resized).
How to fix this?