Php gd hello world

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

 
 

Share on Google+Share on Google+

Php gd hello world

Ads

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

Advertisements

Ads

Posted on: October 30, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles