| Current Path : /var/www/html/mmishra/iws8/html/indem/icdp/ |
| Current File : /var/www/html/mmishra/iws8/html/indem/icdp/text2image.php |
<?php
include "functions.php";
dbConnect();
$title1 = parameter('organization');
$title2 = '[ '.parameter('nickname').' ]';
Header ("Content-type: image/png");
putenv('GDFONTPATH=' . realpath('.'));
$font = 'MTCORSVA.TTF';
$fontSize = 20;//in point;
//$title1 = 'Intelligent Content Delivery Platform';
//$title2 = ' [ ICDP ]';
$str =$title1.' '.$title2;
$onecharwidth = imagefontwidth($font)*($fontSize/6);
$totalwidth = $onecharwidth * strlen($str) + 10;
$height = (imagefontheight($font)*($fontSize/8))*3;
$img_handle = imagecreatetruecolor($totalwidth, $height);
$white = imagecolorallocate($img_handle, 255, 255, 255);
imagefill($img_handle, 0, 0, $white);
$black = imagecolorallocate ($img_handle, rand(0,255), rand(0,255), rand(0,255));
$gray = imagecolorallocate ($img_handle, rand(0,255), rand(0,255), rand(0,255));
imagettftext($img_handle, 35, 0, 10, 40, $black, $font, $title1);
$posarr = imagettfbbox(35, 0, $font, $title1);
imagettftext($img_handle, 35, 0, $posarr[2]+$onecharwidth, 40, $gray, $font, $title2);
imagepng ($img_handle);
imagedestroy ($img_handle);
?>