public function squareCenterCrop(array $options = []) {
		if (empty($options['size'])) {
			throw new \InvalidArgumentException(__d('imagine', 'You have to pass size in the options!'));
		}

		$imageSize = $this->getImageSize($this->_image);

		$width = $imageSize[0];
		$height = $imageSize[1];

		if ($width > $height) {
			$x2 = $height;
			$y2 = $height;
			$x = ($width - $height) / 2;
			$y = 0;
		} else {
			$x2 = $width;
			$y2 = $width;
			$x = 0;
			$y = ($height - $width) / 2;
		}

		$this->_image->crop(new \Imagine\Image\Point($x, $y), new \Imagine\Image\Box($x2, $y2));
		$this->_image->resize(new \Imagine\Image\Box($options['size'], $options['size']));
		return $this;
	}
public function squareCenterCrop(array $options = []) {
		if (empty($options['size'])) {
			throw new \InvalidArgumentException(__d('imagine', 'You have to pass size in the options!'));
		}

		$imageSize = $this->getImageSize($this->_image);

		$width = $imageSize[0];
		$height = $imageSize[1];

		if ($width > $height) {
			$x2 = $height;
			$y2 = $height;
			$x = ($width - $height) / 2;
			$y = 0;
		} else {
			$x2 = $width;
			$y2 = $width;
			$x = 0;
			$y = ($height - $width) / 2;
		}

		$this->_image->crop(new \Imagine\Image\Point($x, $y), new \Imagine\Image\Box($x2, $y2));
		$this->_image->resize(new \Imagine\Image\Box($options['size'], $options['size']));
		return $this;
	}
public function squareCenterCrop ( array $ options = [ ] ) { if ( empty ( $ options [ 'size' ] ) ) { throw new \ InvalidArgumentException ( __d ( 'imagine' , 'You have to pass size in the options!' ) ) ; } $ imageSize = $ this -> getImageSize ( $ this -> _image ) ; $ width = $ imageSize [ 0 ] ; $ height = $ imageSize [ 1 ] ; if ( $ width > $ height ) { $ x2 = $ height ; $ y2 = $ height ; $ x = ( $ width - $ height ) / 2 ; $ y = 0 ; } else { $ x2 = $ width ; $ y2 = $ width ; $ x = 0 ; $ y = ( $ height - $ width ) / 2 ; } $ this -> _image -> crop ( new \ Imagine \ Image \ Point ( $ x , $ y ) , new \ Imagine \ Image \ Box ( $ x2 , $ y2 ) ) ; $ this -> _image -> resize ( new \ Imagine \ Image \ Box ( $ options [ 'size' ] , $ options [ 'size' ] ) ) ; return $ this ; }
Crops an image based on its widht or height, crops it to a square and resizes it to the given size

@param array Array of options for processing the image.
@throws \InvalidArgumentException
@return $this
Crops an image based on its widht or height crops it to a square and resizes it to the given size