/** * Crops the current image to a specified height and width * * @param int $in_cropWidth The width of the new image * @param int $in_cropHeight The height of the new image * @param int $in_cropX The X coordinate on the image to start the crop * @param int $in_cropY The Y coordinate on the image to start the crop * * @access public * @return TRUE or PEAR Error object on error */ function crop($in_cropWidth, $in_cropHeight, $in_cropX, $in_cropY) { // Sanity check if (!$this->_intersects($in_cropWidth, $in_cropHeight, $in_cropX, $in_cropY)) { return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND); } $this->oldHandle = $this->imageHandle; $this->imageHandle = imlib_create_cropped_image($this->imageHandle, $in_cropX, $in_cropY, $in_cropWidth, $in_cropHeight); $this->img_x = $in_cropWidth; $this->img_y = $in_cropHeight; return true; }
/** * Crops the current image to a specified height and width * * @param int $in_cropWidth The width of the new image * @param int $in_cropHeight The height of the new image * @param int $in_cropX The X coordinate on the image to start the crop * @param int $in_cropY The Y coordinate on the image to start the crop * * @access public * @return TRUE or PEAR Error object on error */ function crop($in_cropWidth, $in_cropHeight, $in_cropX, $in_cropY) { $this->oldHandle = $this->imageHandle; $this->imageHandle = imlib_create_cropped_image($this->imageHandle, $in_cropX, $in_cropY, $in_cropWidth, $in_cropHeight); $this->img_x = $in_cropWidth; $this->img_y = $in_cropHeight; return true; }