public function getWrappedText($size, $angle, $fontface, $string, $width = 100)
    {
        $str = '';
        $words = explode(' ', $string);

        foreach ($words as $word) {
            $testStr = $str . ' ' . $word;
            $box = imagettfbbox($size, $angle, $fontface, $testStr);

            if ($box[2] > $width) {
                $str .= ($str == '' ? '' : "\n") . $word;
            } else {
                $str .= ($str == '' ? '' : ' ') . $word;
            }
        }

        $this->string = $str;
        $lines = explode("\n", $str);

        return $lines;
    }
public function getWrappedText($size, $angle, $fontface, $string, $width = 100)
    {
        $str = '';
        $words = explode(' ', $string);

        foreach ($words as $word) {
            $testStr = $str . ' ' . $word;
            $box = imagettfbbox($size, $angle, $fontface, $testStr);

            if ($box[2] > $width) {
                $str .= ($str == '' ? '' : "\n") . $word;
            } else {
                $str .= ($str == '' ? '' : ' ') . $word;
            }
        }

        $this->string = $str;
        $lines = explode("\n", $str);

        return $lines;
    }
public function getWrappedText ( $ size , $ angle , $ fontface , $ string , $ width = 100 ) { $ str = '' ; $ words = explode ( ' ' , $ string ) ; foreach ( $ words as $ word ) { $ testStr = $ str . ' ' . $ word ; $ box = imagettfbbox ( $ size , $ angle , $ fontface , $ testStr ) ; if ( $ box [ 2 ] > $ width ) { $ str .= ( $ str == '' ? '' : "\n" ) . $ word ; } else { $ str .= ( $ str == '' ? '' : ' ' ) . $ word ; } } $ this -> string = $ str ; $ lines = explode ( "\n" , $ str ) ; return $ lines ; }
Gets wrapped text.

@access public
@param int $size Font size fot the text.
@param int $angle Angole for the text.
@param string $fontface Path of TTF font.
@param string $string String text.
@param int $width Width for text box area.
@return array
Gets wrapped text .