protected function getDimensions($text)
    {
        $box = imagettfbbox(38, 0, $this->fontPath, $text);

        return [
            'width' => abs($box[4] - $box[0]),
            'height' => abs($box[5] - $box[1]),
        ];
    }
protected function getDimensions($text)
    {
        $box = imagettfbbox(38, 0, $this->fontPath, $text);

        return [
            'width' => abs($box[4] - $box[0]),
            'height' => abs($box[5] - $box[1]),
        ];
    }
protected function getDimensions ( $ text ) { $ box = imagettfbbox ( 38 , 0 , $ this -> fontPath , $ text ) ; return [ 'width' => abs ( $ box [ 4 ] - $ box [ 0 ] ) , 'height' => abs ( $ box [ 5 ] - $ box [ 1 ] ) , ] ; }
Calculate canvas width and height.

@param string $text

@return array
Calculate canvas width and height .