public function getTransformations() {
        if ($this->transformations === null) {
            $this->transformations = [];

            $transformations = $this->query->get('t', []);

            if (!is_array($transformations)) {
                throw new InvalidArgumentException('Transformations must be specifed as an array', 400);
            }

            foreach ($transformations as $transformation) {
                if (!is_string($transformation)) {
                    throw new InvalidArgumentException('Invalid transformation', 400);
                }

                // See if the transformation has any parameters
                $pos = strpos($transformation, ':');
                $urlParams = '';

                if ($pos === false) {
                    // No params exist
                    $name = $transformation;
                } else {
                    list($name, $urlParams) = explode(':', $transformation, 2);
                }

                // Initialize params for the transformation
                $params = [];

                // Loop through the parameter string and assign params to an array
                $offset = 0;
                $pattern = '#(\w+)=(?:(.+?),\w+=|(.+?$))#';
                while (preg_match($pattern, $urlParams, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                    $offset = $matches[2][1];
                    $paramName = $matches[1][0];
                    $paramValue = isset($matches[3]) ? $matches[3][0] : $matches[2][0];
                    $params[$paramName] = $paramValue;
                }

                $this->transformations[] = [
                    'name'   => $name,
                    'params' => $params,
                ];
            }
        }

        return $this->transformations;
    }
public function getTransformations() {
        if ($this->transformations === null) {
            $this->transformations = [];

            $transformations = $this->query->get('t', []);

            if (!is_array($transformations)) {
                throw new InvalidArgumentException('Transformations must be specifed as an array', 400);
            }

            foreach ($transformations as $transformation) {
                if (!is_string($transformation)) {
                    throw new InvalidArgumentException('Invalid transformation', 400);
                }

                // See if the transformation has any parameters
                $pos = strpos($transformation, ':');
                $urlParams = '';

                if ($pos === false) {
                    // No params exist
                    $name = $transformation;
                } else {
                    list($name, $urlParams) = explode(':', $transformation, 2);
                }

                // Initialize params for the transformation
                $params = [];

                // Loop through the parameter string and assign params to an array
                $offset = 0;
                $pattern = '#(\w+)=(?:(.+?),\w+=|(.+?$))#';
                while (preg_match($pattern, $urlParams, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                    $offset = $matches[2][1];
                    $paramName = $matches[1][0];
                    $paramValue = isset($matches[3]) ? $matches[3][0] : $matches[2][0];
                    $params[$paramName] = $paramValue;
                }

                $this->transformations[] = [
                    'name'   => $name,
                    'params' => $params,
                ];
            }
        }

        return $this->transformations;
    }
public function getTransformations ( ) { if ( $ this -> transformations === null ) { $ this -> transformations = [ ] ; $ transformations = $ this -> query -> get ( 't' , [ ] ) ; if ( ! is_array ( $ transformations ) ) { throw new InvalidArgumentException ( 'Transformations must be specifed as an array' , 400 ) ; } foreach ( $ transformations as $ transformation ) { if ( ! is_string ( $ transformation ) ) { throw new InvalidArgumentException ( 'Invalid transformation' , 400 ) ; } // See if the transformation has any parameters $ pos = strpos ( $ transformation , ':' ) ; $ urlParams = '' ; if ( $ pos === false ) { // No params exist $ name = $ transformation ; } else { list ( $ name , $ urlParams ) = explode ( ':' , $ transformation , 2 ) ; } // Initialize params for the transformation $ params = [ ] ; // Loop through the parameter string and assign params to an array $ offset = 0 ; $ pattern = '#(\w+)=(?:(.+?),\w+=|(.+?$))#' ; while ( preg_match ( $ pattern , $ urlParams , $ matches , PREG_OFFSET_CAPTURE , $ offset ) ) { $ offset = $ matches [ 2 ] [ 1 ] ; $ paramName = $ matches [ 1 ] [ 0 ] ; $ paramValue = isset ( $ matches [ 3 ] ) ? $ matches [ 3 ] [ 0 ] : $ matches [ 2 ] [ 0 ] ; $ params [ $ paramName ] = $ paramValue ; } $ this -> transformations [ ] = [ 'name' => $ name , 'params' => $ params , ] ; } } return $ this -> transformations ; }
Get image transformations from the request

@return array
Get image transformations from the request