src/ImboClient/Http/ImageUrl.php
public function canvas($width, $height, $mode = null, $x = null, $y = null, $bg = null) {
        if (!$width || !$height) {
            throw new InvalidArgumentException('width and height must be specified');
        }

        $params = array(
            'width=' . (int) $width,
            'height=' . (int) $height,
        );

        if ($mode) {
            $params[] = 'mode=' . $mode;
        }

        if ($x) {
            $params[] = 'x=' . (int) $x;
        }

        if ($y) {
            $params[] = 'y=' . (int) $y;
        }

        if ($bg) {
            $params[] = 'bg=' . $bg;
        }

        return $this->addTransformation(sprintf('canvas:%s', implode(',', $params)));
    }
public function canvas($width, $height, $mode = null, $x = null, $y = null, $bg = null) {
        if (!$width || !$height) {
            throw new InvalidArgumentException('width and height must be specified');
        }

        $params = array(
            'width=' . (int) $width,
            'height=' . (int) $height,
        );

        if ($mode) {
            $params[] = 'mode=' . $mode;
        }

        if ($x) {
            $params[] = 'x=' . (int) $x;
        }

        if ($y) {
            $params[] = 'y=' . (int) $y;
        }

        if ($bg) {
            $params[] = 'bg=' . $bg;
        }

        return $this->addTransformation(sprintf('canvas:%s', implode(',', $params)));
    }
public function canvas ( $ width , $ height , $ mode = null , $ x = null , $ y = null , $ bg = null ) { if ( ! $ width || ! $ height ) { throw new InvalidArgumentException ( 'width and height must be specified' ) ; } $ params = array ( 'width=' . ( int ) $ width , 'height=' . ( int ) $ height , ) ; if ( $ mode ) { $ params [ ] = 'mode=' . $ mode ; } if ( $ x ) { $ params [ ] = 'x=' . ( int ) $ x ; } if ( $ y ) { $ params [ ] = 'y=' . ( int ) $ y ; } if ( $ bg ) { $ params [ ] = 'bg=' . $ bg ; } return $ this -> addTransformation ( sprintf ( 'canvas:%s' , implode ( ',' , $ params ) ) ) ; }
Add a canvas transformation

@param int $width Width of the canvas
@param int $height Height of the canvas
@param string $mode The placement mode, "free", "center", "center-x" or "center-y"
@param int $x X coordinate of the placement of the upper left corner of the existing image
@param int $y Y coordinate of the placement of the upper left corner of the existing image
@param string $bg Background color of the canvas
@return self
@throws InvalidArgumentException
Add a canvas transformation