Home Tutorial Php Phpgd PHP GD spiral Images

 
 

Share on Google+Share on Google+
PHP GD spiral Images
Posted on: November 3, 2009 at 12:00 AM
Advertisement
This example shows how to display spiral images in php gd Library.

<?php

$text = "Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia Roseindia";

$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)/3));

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

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

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

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

$x = 0;

$y = 180-$i;

$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 spiral Images:


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 3, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com