Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 436 Bytes

writing_text_in_an_image.md

File metadata and controls

15 lines (12 loc) · 436 Bytes

Writing text in an image

$image = imagecreate(400, 300);
$blue = imagecolorallocate($image, 0, 0, 255);
$white = ImageColorAllocate($image, 255,255,255);

if (! isset($_GET['size'])) $_GET['size'] = 44;
if (! isset($_GET['text'])) $_GET['text'] = "Hello, world!";

imagettftext($image, $_GET['size'], 15, 50, 200, $white, "ARIAL", $_GET['text']);
header("content-type: image/png");
imagepng($image);
imagedestroy($image);