<?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>Compiled Thoughts by John Ciacia &#187; text</title>
	<atom:link href="http://www.johnciacia.com/tag/text/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnciacia.com</link>
	<description>Science, Technology, and Beyond</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:46:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using PHP and GD to add border to text</title>
		<link>http://www.johnciacia.com/2010/01/04/using-php-and-gd-to-add-border-to-text/</link>
		<comments>http://www.johnciacia.com/2010/01/04/using-php-and-gd-to-add-border-to-text/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 23:41:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[border]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[image border]]></category>
		<category><![CDATA[imagettf]]></category>
		<category><![CDATA[stroke]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[text border]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=449</guid>
		<description><![CDATA[[code lang="PHP"][/code]]]></description>
			<content:encoded><![CDATA[<p>[code lang="PHP"]<?php<br />
/**<br />
 * Writes the given text with a border into the image using TrueType fonts.<br />
 * @author John Ciacia<br />
 * @param image An image resource<br />
 * @param size The font size<br />
 * @param angle The angle in degrees to rotate the text<br />
 * @param x Upper left corner of the text<br />
 * @param y Lower left corner of the text<br />
 * @param textcolor This is the color of the main text<br />
 * @param strokecolor This is the color of the text border<br />
 * @param fontfile The path to the TrueType font you wish to use<br />
 * @param text The text string in UTF-8 encoding<br />
 * @param px Number of pixels the text border will be<br />
 * @see http://us.php.net/manual/en/function.imagettftext.php<br />
 */<br />
function imagettfstroketext(&#038;$image, $size, $angle, $x, $y, &#038;$textcolor, &#038;$strokecolor, $fontfile, $text, $px) {</p>
<p>    for($c1 = ($x-abs($px)); $c1 <= ($x+abs($px)); $c1++)<br />
        for($c2 = ($y-abs($px)); $c2 <= ($y+abs($px)); $c2++)<br />
            $bg = imagettftext($image, $size, $angle, $c1, $c2, $strokecolor, $fontfile, $text);</p>
<p>   return imagettftext($image, $size, $angle, $x, $y, $textcolor, $fontfile, $text);<br />
} [/code]</p>
<p>[code lang="PHP"]<?php<br />
$img = imagecreatefrompng("/home/john/Desktop/test.png");<br />
$font_color = imagecolorallocate($img, 0, 0, 0);<br />
$stroke_color = imagecolorallocate($img, 255, 0, 0);<br />
imagettfstroketext($img, 10, 0, 10, 50, $font_color, $stroke_color, "abstract.ttf", "Hello, World!", 2);<br />
?>[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2010/01/04/using-php-and-gd-to-add-border-to-text/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.johnciacia.com @ 2012-02-05 10:35:34 -->
