public function make($text, $multiple = false)
    {
        $texts = explode(PHP_EOL, $this->breakText($text));

        $texts = $multiple ? array_chunk($texts, 20) : [$texts];

        $images = [];

        foreach ($texts as $text) {
            $text = trim(implode(PHP_EOL, $text));

            $dimensions = $this->getDimensions($text);

            $images[] = $this->image
                ->canvas($dimensions['width'], $dimensions['height'], "#{$this->color}")
                ->text($text, $dimensions['width'] / 2, $dimensions['height'] / 2, function (AbstractFont $font) {
                    $font->file($this->fontPath)
                        ->size(48)
                        ->color((new Color($this->color))->isDark() ? '#fff' : '#000')
                        ->align('center')
                        ->valign('middle');
                });
        }

        return $multiple ? $images : $images[0];
    }
public function make($text, $multiple = false)
    {
        $texts = explode(PHP_EOL, $this->breakText($text));

        $texts = $multiple ? array_chunk($texts, 20) : [$texts];

        $images = [];

        foreach ($texts as $text) {
            $text = trim(implode(PHP_EOL, $text));

            $dimensions = $this->getDimensions($text);

            $images[] = $this->image
                ->canvas($dimensions['width'], $dimensions['height'], "#{$this->color}")
                ->text($text, $dimensions['width'] / 2, $dimensions['height'] / 2, function (AbstractFont $font) {
                    $font->file($this->fontPath)
                        ->size(48)
                        ->color((new Color($this->color))->isDark() ? '#fff' : '#000')
                        ->align('center')
                        ->valign('middle');
                });
        }

        return $multiple ? $images : $images[0];
    }
public function make ( $ text , $ multiple = false ) { $ texts = explode ( PHP_EOL , $ this -> breakText ( $ text ) ) ; $ texts = $ multiple ? array_chunk ( $ texts , 20 ) : [ $ texts ] ; $ images = [ ] ; foreach ( $ texts as $ text ) { $ text = trim ( implode ( PHP_EOL , $ text ) ) ; $ dimensions = $ this -> getDimensions ( $ text ) ; $ images [ ] = $ this -> image -> canvas ( $ dimensions [ 'width' ] , $ dimensions [ 'height' ] , "#{$this->color}" ) -> text ( $ text , $ dimensions [ 'width' ] / 2 , $ dimensions [ 'height' ] / 2 , function ( AbstractFont $ font ) { $ font -> file ( $ this -> fontPath ) -> size ( 48 ) -> color ( ( new Color ( $ this -> color ) ) -> isDark ( ) ? '#fff' : '#000' ) -> align ( 'center' ) -> valign ( 'middle' ) ; } ) ; } return $ multiple ? $ images : $ images [ 0 ] ; }
Create a text image.

@param string $text
@param bool $multiple

@return Image|Image[]
Create a text image .