src/Support/Image/Resizer.php
protected function resizeCrop(ImageInterface $image, $width, $height)
    {
        list($optimalWidth, $optimalHeight) = $this->getOptimalCrop($image->getSize(), $width, $height);

        // Find center - this will be used for the crop
        $centerX = ($optimalWidth / 2) - ($width / 2);
        $centerY = ($optimalHeight / 2) - ($height / 2);

        return $image->resize(new Box($optimalWidth, $optimalHeight))
            ->crop(new Point($centerX, $centerY), new Box($width, $height));
    }
protected function resizeCrop(ImageInterface $image, $width, $height)
    {
        list($optimalWidth, $optimalHeight) = $this->getOptimalCrop($image->getSize(), $width, $height);

        // Find center - this will be used for the crop
        $centerX = ($optimalWidth / 2) - ($width / 2);
        $centerY = ($optimalHeight / 2) - ($height / 2);

        return $image->resize(new Box($optimalWidth, $optimalHeight))
            ->crop(new Point($centerX, $centerY), new Box($width, $height));
    }
protected function resizeCrop ( ImageInterface $ image , $ width , $ height ) { list ( $ optimalWidth , $ optimalHeight ) = $ this -> getOptimalCrop ( $ image -> getSize ( ) , $ width , $ height ) ; // Find center - this will be used for the crop $ centerX = ( $ optimalWidth / 2 ) - ( $ width / 2 ) ; $ centerY = ( $ optimalHeight / 2 ) - ( $ height / 2 ) ; return $ image -> resize ( new Box ( $ optimalWidth , $ optimalHeight ) ) -> crop ( new Point ( $ centerX , $ centerY ) , new Box ( $ width , $ height ) ) ; }
Resize an image and then center crop it

@param ImageInterface $image
@param string         $width     new width
@param string         $height    new height
@return ImageInterface
Resize an image and then center crop it