/** * Crop image into specified frame * * @throws Zend_Image_Driver_Exception * @param int $left Left point to crop from * @param int $top Top point to crop from * @param int $width Width to crop * @param int $height Height to crop * @return bool */ public function crop($left, $top, $width, $height) { parent::crop($left, $top, $width, $height); $imageSize = $this->getSize(); $croppedImage = imagecreatetruecolor($width, $height); if ($this->_type == "png") { imagealphablending($croppedImage, true); } $successfull = imagecopyresized($croppedImage, $this->_image, 0, 0, $left, $top, $width, $height, $left + $width, $top + $height); unset($this->_image); $this->_image = $croppedImage; return $successfull; }
public function crop($left, $top, $targetWidth, $targetHeight) { parent::crop($left, $top, $targetWidth, $targetHeight); $this->_imagick->cropimage($targetWidth, $targetHeight, $left, $top); }