Home Tutorial Php Phpgd Php gd hello world

 
 

Php gd hello world
Posted on: October 30, 2009 at 12:00 AM
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

Related Tags for Php gd hello world:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.