/**
  * Crop the image 
  *
  * @param Asido_TMP &$tmp
  * @param integer $x
  * @param integer $y
  * @param integer $width
  * @param integer $height
  * @return boolean
  * @access protected
  */
 function __crop(&$tmp, $x, $y, $width, $height)
 {
     if (!imagick_crop($tmp->target, $x, $y, $width, $height)) {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Crops the image
  *
  * @param int width Cropped image width
  * @param int height Cropped image height
  * @param int x X-coordinate to crop at
  * @param int y Y-coordinate to crop at
  *
  * @return bool|PEAR_Error TRUE or a PEAR_Error object on error
  * @access public
  */
 function crop($width, $height, $x = 0, $y = 0)
 {
     if (!imagick_crop($this->imageHandle, $x, $y, $x + $width, $y + $height)) {
         return $this->raiseError('Couldn\'t crop image.', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     // I think that setting img_x/y is wrong, but scaleByLength() & friends
     // mess up the aspect after a crop otherwise.
     $this->new_x = $width;
     $this->new_y = $height;
     return true;
 }
 /**
  * Crops the image
  *
  * @param int width Cropped image width
  * @param int height Cropped image height
  * @param int x X-coordinate to crop at
  * @param int y Y-coordinate to crop at
  *
  * @return bool|PEAR_Error TRUE or a PEAR_Error object on error
  * @access public
  */
 function crop($width, $height, $x = 0, $y = 0)
 {
     // Sanity check
     if (!$this->intersects($width, $height, $x, $y)) {
         return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);
     }
     if (!imagick_crop($this->imageHandle, $x, $y, $width, $height)) {
         return $this->raiseError('Couldn\'t crop image.', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     // I think that setting img_x/y is wrong, but scaleByLength() & friends
     // mess up the aspect after a crop otherwise.
     $this->new_x = $width;
     $this->new_y = $height;
     return true;
 }