Location: PHPKode > scripts > ArGlyphs > arglyphs/gd_example/gd_example.php
<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = @imagecreatefromgif('images/bg.gif');

// Create some colors
$black = imagecolorallocate($im, 0, 0, 0);
$blue  = imagecolorallocate($im, 0, 0, 255);

// Replace by your own font full path and name
$font  = 'trado.ttf';

// UTF-8 charset
$text = "بسم الله الرحمن الرحيم";
imagettftext($im, 20, 0, 10, 50, $blue, $font, 'UTF-8:');
imagettftext($im, 20, 0, 200, 50, $black, $font, $text);

require('ArGlyphs.class.php');
$ArabicGD = new ArGlyphs();
$text = "ÈÓã Çááå ÇáÑÍãä ÇáÑÍíã";
$text = $ArabicGD->convert($text);
imagettftext($im, 20, 0, 10, 100, $blue, $font, 'ArGlyphs:');
imagettftext($im, 20, 0, 200, 100, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
Return current item: ArGlyphs