src/Manipulators/Size.php
public function getCrop()
    {
        $cropMethods = [
            'crop-top-left' => [0, 0, 1.0],
            'crop-top' => [50, 0, 1.0],
            'crop-top-right' => [100, 0, 1.0],
            'crop-left' => [0, 50, 1.0],
            'crop-center' => [50, 50, 1.0],
            'crop-right' => [100, 50, 1.0],
            'crop-bottom-left' => [0, 100, 1.0],
            'crop-bottom' => [50, 100, 1.0],
            'crop-bottom-right' => [100, 100, 1.0],
        ];

        if (array_key_exists($this->fit, $cropMethods)) {
            return $cropMethods[$this->fit];
        }

        if (preg_match('/^crop-([\d]{1,3})-([\d]{1,3})(?:-([\d]{1,3}(?:\.\d+)?))*$/', $this->fit, $matches)) {
            $matches[3] = isset($matches[3]) ? $matches[3] : 1;

            if ($matches[1] > 100 or $matches[2] > 100 or $matches[3] > 100) {
                return [50, 50, 1.0];
            }

            return [
                (int) $matches[1],
                (int) $matches[2],
                (float) $matches[3],
            ];
        }

        return [50, 50, 1.0];
    }
public function getCrop()
    {
        $cropMethods = [
            'crop-top-left' => [0, 0, 1.0],
            'crop-top' => [50, 0, 1.0],
            'crop-top-right' => [100, 0, 1.0],
            'crop-left' => [0, 50, 1.0],
            'crop-center' => [50, 50, 1.0],
            'crop-right' => [100, 50, 1.0],
            'crop-bottom-left' => [0, 100, 1.0],
            'crop-bottom' => [50, 100, 1.0],
            'crop-bottom-right' => [100, 100, 1.0],
        ];

        if (array_key_exists($this->fit, $cropMethods)) {
            return $cropMethods[$this->fit];
        }

        if (preg_match('/^crop-([\d]{1,3})-([\d]{1,3})(?:-([\d]{1,3}(?:\.\d+)?))*$/', $this->fit, $matches)) {
            $matches[3] = isset($matches[3]) ? $matches[3] : 1;

            if ($matches[1] > 100 or $matches[2] > 100 or $matches[3] > 100) {
                return [50, 50, 1.0];
            }

            return [
                (int) $matches[1],
                (int) $matches[2],
                (float) $matches[3],
            ];
        }

        return [50, 50, 1.0];
    }
public function getCrop ( ) { $ cropMethods = [ 'crop-top-left' => [ 0 , 0 , 1.0 ] , 'crop-top' => [ 50 , 0 , 1.0 ] , 'crop-top-right' => [ 100 , 0 , 1.0 ] , 'crop-left' => [ 0 , 50 , 1.0 ] , 'crop-center' => [ 50 , 50 , 1.0 ] , 'crop-right' => [ 100 , 50 , 1.0 ] , 'crop-bottom-left' => [ 0 , 100 , 1.0 ] , 'crop-bottom' => [ 50 , 100 , 1.0 ] , 'crop-bottom-right' => [ 100 , 100 , 1.0 ] , ] ; if ( array_key_exists ( $ this -> fit , $ cropMethods ) ) { return $ cropMethods [ $ this -> fit ] ; } if ( preg_match ( '/^crop-([\d]{1,3})-([\d]{1,3})(?:-([\d]{1,3}(?:\.\d+)?))*$/' , $ this -> fit , $ matches ) ) { $ matches [ 3 ] = isset ( $ matches [ 3 ] ) ? $ matches [ 3 ] : 1 ; if ( $ matches [ 1 ] > 100 or $ matches [ 2 ] > 100 or $ matches [ 3 ] > 100 ) { return [ 50 , 50 , 1.0 ] ; } return [ ( int ) $ matches [ 1 ] , ( int ) $ matches [ 2 ] , ( float ) $ matches [ 3 ] , ] ; } return [ 50 , 50 , 1.0 ] ; }
Resolve crop with zoom.
@return integer[] The resolved crop.
Resolve crop with zoom .