Spatie\MediaLibrary\Conversion\Conversion::setCrop PHP Method

setCrop() public method

Crops the image to specific dimensions prior to any other resize operations.
public setCrop ( integer $width, integer $height, integer $x, integer $y )
$width integer
$height integer
$x integer
$y integer
    public function setCrop(int $width, int $height, int $x, int $y)
    {
        foreach (compact('width', 'height') as $name => $value) {
            if ($value < 1) {
                throw InvalidConversionParameter::shouldBeGreaterThanOne($name, $value);
            }
        }
        $this->setManipulationParameter('crop', implode(',', [$width, $height, $x, $y]));
        return $this;
    }