public function crop($width, $height, $offsetX = 0, $offsetY = 0)
{
if (version_compare(PHP_VERSION, '5.5.0') < 0) {
$image = imagecreatetruecolor($width, $height);
imagealphablending($image, false);
imagesavealpha($image, true);
imagecopy($image, $this->_image, 0, 0, $offsetX, $offsetY, $width, $height);
} else {
$rect = ['x' => $offsetX, 'y' => $offsetY, 'width' => $width, 'height' => $height];
$image = imagecrop($this->_image, $rect);
}
imagedestroy($this->_image);
$this->_image = $image;
$this->_width = imagesx($image);
$this->_height = imagesy($image);
return $this;
}