<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ItHowTo.ro &#187; circular text</title>
	<atom:link href="http://www.ithowto.ro/tag/circular-text/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ithowto.ro</link>
	<description>Blog about IT realated stuff by WSS</description>
	<lastBuildDate>Tue, 06 Jul 2010 16:35:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HowTo: write circular text with php and gd</title>
		<link>http://www.ithowto.ro/2009/03/howto-write-circular-text-with-php-and-gd/</link>
		<comments>http://www.ithowto.ro/2009/03/howto-write-circular-text-with-php-and-gd/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 10:20:14 +0000</pubDate>
		<dc:creator>radone</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[circular text]]></category>
		<category><![CDATA[gd]]></category>

		<guid isPermaLink="false">http://www.ithowto.ro/?p=77</guid>
		<description><![CDATA[I had a project in which I had to generate an image based on a string. The problem was that the text had to be displayed circulary. After hours of internet searching I&#8217;ve came across http://www.phpgd.com and found this piece of code which did the job quite nicely.
&#60;?php
$text = &#8220;Around and around around and around [...]]]></description>
			<content:encoded><![CDATA[<p>I had a project in which I had to generate an image based on a string. The problem was that the text had to be displayed circulary. After hours of internet searching I&#8217;ve came across <a href="http://www.phpgd.com" target="_blank">http://www.phpgd.com</a> and found this piece of code which did the job quite nicely.</p>
<p>&lt;?php</p>
<p>$text = &#8220;Around and around around and around and around &#8220;;</p>
<p>$image = imagecreatetruecolor(400,400);<br />
$white = imagecolorallocate($image,255,255,255);<br />
imagefill($image,0,0,$white);<br />
$red = imagecolorallocate($image,255,0,0);</p>
<p>$degrees = (360/strlen($text));</p>
<p>for ($i=0;$i&lt;strlen($text);$i++) {</p>
<p>$a = ($degrees*$i)+180;</p>
<p>$cos = cos(deg2rad($a));<br />
$sin = sin(deg2rad($a));<br />
$x = 0;<br />
$y = 180;<br />
$xt = round($cos*($x) &#8211; $sin*($y));<br />
$yt = round($sin*($x) + $cos*($y));<br />
imagettftext($image,20,180-($a),200+$xt,200+$yt,$red,&#8221;fonts/arial.ttf&#8221;,$text[$i]);</p>
<p>}</p>
<p>header(&#8220;Content-type: image/jpeg&#8221;);<br />
imagejpeg($image,&#8221;",100);<br />
imagedestroy($image);</p>
<p>?&gt;</p>
<p>Here is the direct link to the script <a href="http://www.phpgd.com/scripts.php?script=25" target="_blank">http://www.phpgd.com/scripts.php?script=25</a>. You might look through the site because there are other many interesting scripts which may come useful in your projects.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ithowto.ro/2009/03/howto-write-circular-text-with-php-and-gd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
