Home Tutorial Php Phpgd PHP GD circle

 
 

Share on Google+Share on Google+
PHP GD circle
Posted on: November 4, 2009 at 12:00 AM
Advertisement
This example shows how to make circle in php gd.

<?php

$text = "RoseindiaRoseindiaRoseindiaRoseindiaRoseindia ";

$image = imagecreatetruecolor(400,400);

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

imagefill($image,0,0,$white);

$red = imagecolorallocate($image,255,0,0);

$degrees = (360/strlen($text));

for ($i=0;$i<strlen($text);$i++) {

$a = ($degrees*$i)+180;

$cos = cos(deg2rad($a));

$sin = sin(deg2rad($a));

$x = 0;

$y = 180;

$xt = round($cos*($x) - $sin*($y));

$yt = round($sin*($x) + $cos*($y));

imagettftext($image,20,180-($a),200+$xt,200+$yt,$red,"C:/WINNT/Fonts/arial.ttf",$text[$i]);

}

header("Content-type: image/jpeg");

imagejpeg($image,"",100);

imagedestroy($image);

?>

After running the program you will get the following output

Advertisement

Related Tags for PHP GD circle:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 4, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com