src/Support/Image/Resizer.php
protected function parseOptionDimensions(array $options)
    {
        $sourceDimensions = $this->arrGet($options, 'dimensions');

        if (is_callable($sourceDimensions)) {
            return [null, null, 'custom'];
        }

        if (strpos($sourceDimensions, 'x') === false) {
            // Width given, height automagically selected to preserve aspect ratio (landscape).
            $width = $sourceDimensions;

            return [$width, null, 'landscape'];
        }

        $dimensions = explode('x', $sourceDimensions);
        $width  = $dimensions[0];
        $height = $dimensions[1];

        if (empty($width)) {
            // Height given, width matched to preserve aspect ratio (portrait)
            return [null, $height, 'portrait'];
        }

        $resizingOption = substr($height, -1, 1);


        if ($resizingOption == '#') {
            // Resize, then crop
            $height = rtrim($height, '#');

            return [$width, $height, 'crop'];
        }

        if ($resizingOption == '!') {
            // Resize by exact width/height (ignore ratio)
            $height = rtrim($height, '!');

            return [$width, $height, 'exact'];
        }

        return [$width, $height, 'auto'];
    }
protected function parseOptionDimensions(array $options)
    {
        $sourceDimensions = $this->arrGet($options, 'dimensions');

        if (is_callable($sourceDimensions)) {
            return [null, null, 'custom'];
        }

        if (strpos($sourceDimensions, 'x') === false) {
            // Width given, height automagically selected to preserve aspect ratio (landscape).
            $width = $sourceDimensions;

            return [$width, null, 'landscape'];
        }

        $dimensions = explode('x', $sourceDimensions);
        $width  = $dimensions[0];
        $height = $dimensions[1];

        if (empty($width)) {
            // Height given, width matched to preserve aspect ratio (portrait)
            return [null, $height, 'portrait'];
        }

        $resizingOption = substr($height, -1, 1);


        if ($resizingOption == '#') {
            // Resize, then crop
            $height = rtrim($height, '#');

            return [$width, $height, 'crop'];
        }

        if ($resizingOption == '!') {
            // Resize by exact width/height (ignore ratio)
            $height = rtrim($height, '!');

            return [$width, $height, 'exact'];
        }

        return [$width, $height, 'auto'];
    }
protected function parseOptionDimensions ( array $ options ) { $ sourceDimensions = $ this -> arrGet ( $ options , 'dimensions' ) ; if ( is_callable ( $ sourceDimensions ) ) { return [ null , null , 'custom' ] ; } if ( strpos ( $ sourceDimensions , 'x' ) === false ) { // Width given, height automagically selected to preserve aspect ratio (landscape). $ width = $ sourceDimensions ; return [ $ width , null , 'landscape' ] ; } $ dimensions = explode ( 'x' , $ sourceDimensions ) ; $ width = $ dimensions [ 0 ] ; $ height = $ dimensions [ 1 ] ; if ( empty ( $ width ) ) { // Height given, width matched to preserve aspect ratio (portrait) return [ null , $ height , 'portrait' ] ; } $ resizingOption = substr ( $ height , - 1 , 1 ) ; if ( $ resizingOption == '#' ) { // Resize, then crop $ height = rtrim ( $ height , '#' ) ; return [ $ width , $ height , 'crop' ] ; } if ( $ resizingOption == '!' ) { // Resize by exact width/height (ignore ratio) $ height = rtrim ( $ height , '!' ) ; return [ $ width , $ height , 'exact' ] ; } return [ $ width , $ height , 'auto' ] ; }
Parses the dimensions given in the options.

Parse the given style dimensions to extract out the file processing options,
perform any necessary image resizing for a given style.

@param array $options

@return array
Parses the dimensions given in the options .