Php gd hello world


 

Php gd hello world

This tutorial is about the displaying the hello world in PHP GD Library.

This tutorial is about the displaying the hello world in PHP GD Library.

<?php

ini_set("display_errors", "1");

error_reporting(E_ALL);

header('content-type: image/png');

$image = imagecreatetruecolor(300, 300);

$dark_grey = imagecolorallocate($image, 102, 102, 102);

$white = imagecolorallocate($image, 255, 255, 255);

$font_path = 'C:/WINNT/Fonts/arial.ttf';

$string = 'Hello World!';

imagettftext ($image, 30, 0, 10, 130, $white, $font_path, $string);

imagegif($image);

imagedestroy($image);

?>

After running the program you will get the following output

Ads