PHP code example of turbo / text2image
1. Go to this page and download the library: Download turbo/text2image library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
turbo / text2image example snippets
use Turbo\text2Image\text2Image;
// 指定容器宽高
$width = 800;
$height = 600;
// 当不指定宽时,将不自动断行
// 当指定高时,文字超出部分将不会显示
$image = new text2Image($width, $height);
$text = <<<MSG_EOF
// Set the enviroment variable for GD
putenv('GDFONTPATH=' . realpath('.'));
// Name the font to be used (note the lack of the .ttf extension)
// = SomeFont;