/** * Execute cropping with current params * @param int $x - pixels from top * @param int $y - pixels from left * @param int $width - width from initial point in pixels * @param int $height - height from initial point in pixels * @throws \Exception * @return string - new file name */ public function execute($x, $y, $width = null, $height = null) { if (!isset($this->params['source_image'])) { throw new \Exception('Cropping cannot be completed because source image is not set.'); } $this->prepareParams($x, $y, $width, $height); $this->imageLib->initialize($this->params); //print_d($this->params); $this->imageLib->crop(); return $this->params['new_image']; }