Closed onigetoc closed 10 years ago
<?php
require './vendor/autoload.php';
use GDText\Box;
$im = imagecreatetruecolor(500, 500); // create image
$backgroundColor = imagecolorallocate($im, 64, 86, 221);
imagefill($im, 0, 0, $backgroundColor); // fill image with color
$box = new Box($im);
$box->setFontFace('BebasNeue.otf'); // assuming you have this font http://www.dafont.com/bebas-neue.font
$box->setFontColor([235, 138, 34]); // RGB
$box->setTextShadow([50, 50, 50], 0, -1); // shadow color, x and y shift values
$box->setFontSize(50);
$box->setLeading(0.8);
$box->setBox(50, 50, 400, 400);
$box->setTextAlign('center', 'center'); // x and y align
$box->draw("Lorem Ipsum\nDolor\nSit Amet");
header("Content-type: image/png");
imagepng($im);
Thank you but i have php error on line 13 and 14
It's because you have PHP older than 5.4. In 5.3 and lower you must use array()
instead of []
You script look interesting but there's no example how to use it.
Can you provide some example?