<?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>PHP Tutorials Code Snippets and Php Tips &#187; php email to image</title>
	<atom:link href="http://readytousesolutions.com/phpblog/tag/php-email-to-image/feed/" rel="self" type="application/rss+xml" />
	<link>http://readytousesolutions.com/phpblog</link>
	<description>PHP tutorials - Examples of the most useful scripts</description>
	<lastBuildDate>Thu, 23 Sep 2010 06:54:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP Tutorial : Write text and convert into image</title>
		<link>http://readytousesolutions.com/phpblog/php-tutorial-write-text-and-convert-into-image/</link>
		<comments>http://readytousesolutions.com/phpblog/php-tutorial-write-text-and-convert-into-image/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 05:07:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Usefull PHP]]></category>
		<category><![CDATA[php convert text into image]]></category>
		<category><![CDATA[php email to image]]></category>
		<category><![CDATA[php merge text into image]]></category>
		<category><![CDATA[php write text to an image]]></category>
		<category><![CDATA[php write to image]]></category>
		<category><![CDATA[Write text and convert into image]]></category>

		<guid isPermaLink="false">http://www.crivionweb.com/phpblog/?p=328</guid>
		<description><![CDATA[The base usage in my mind when I write this tutorial to convert text into image with php is to write email into images dinamically to avoid spammers collecting such addresses from the internet. To run such a script you &#8230; <a href="http://readytousesolutions.com/phpblog/php-tutorial-write-text-and-convert-into-image/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The base usage in my mind when I write this tutorial to convert text into image with php is to write email into images dinamically to avoid spammers collecting such addresses from the internet.</p>
<p>To run such a script you must have GD library installed. We&#8217;ll take parametres via GET and merge into image:</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpKeyword">
if<span class="phpOperator">(</span></span><span class="phpOperator">!</span><span class="phpFunction">isset</span><span class="phpOperator">(</span><span class="phpScriptVar">$_GET</span><span class="phpOperator">[</span><span class="phpString">'text'</span><span class="phpOperator">]</span><span class="phpOperator">)</span><span class="phpOperator">)</span>
<span class="phpOperator">{</span>
<span class="phpFunction">die</span><span class="phpOperator">(</span><span class="phpString">"No text provided"</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpFunction">header</span> <span class="phpOperator">(</span><span class="phpString">"Content-type<span class="phpOperator">:</span> image/png"</span><span class="phpOperator">)</span><span class="phpText">;</span>
$textToConvert <span class="phpOperator">=</span> <span class="phpScriptVar">$_GET</span><span class="phpOperator">[</span><span class="phpString">'text'</span><span class="phpOperator">]</span><span class="phpText">;</span>
$font   <span class="phpOperator">=</span> <span class="phpNumber">4</span><span class="phpText">;</span>
$width  <span class="phpOperator">=</span><span class="htmlText"> ImageFontWidth</span><span class="phpOperator">(</span>$font<span class="phpOperator">)</span> * <span class="phpFunction">strlen</span><span class="phpOperator">(</span>$textToConvert<span class="phpOperator">)</span><span class="phpText">;</span>
$height <span class="phpOperator">=</span><span class="htmlText"> ImageFontHeight</span><span class="phpOperator">(</span>$font<span class="phpOperator">)</span><span class="phpText">;</span>
$im <span class="phpOperator">=</span> @<span class="phpFunction">imagecreate</span> <span class="phpOperator">(</span>$width,$height<span class="phpOperator">)</span><span class="phpText">;</span>
$background_color <span class="phpOperator">=</span> <span class="phpFunction">imagecolorallocate</span> <span class="phpOperator">(</span>$im, 255, 255, 255<span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpComment">//this means it&#039;s white bg
</span>$text_color <span class="phpOperator">=</span> <span class="phpFunction">imagecolorallocate</span> <span class="phpOperator">(</span>$im, <span class="phpNumber">0</span>, <span class="phpNumber">0</span>,0<span class="phpOperator">)</span><span class="phpText">;</span><span class="phpComment">//and of course black text
</span><span class="phpFunction">imagestring</span> <span class="phpOperator">(</span>$im, $font, <span class="phpNumber">0</span>, <span class="phpNumber">0</span>,  $textToConvert, $text_color<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunction">imagepng</span> <span class="phpOperator">(</span>$im<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>Save this as textToImage.php and then when you want to create the image and read text do it like :</p>
<pre class="html">
<span class="htmlImageTag">&lt;img src=<span class="htmlAttributeValue">&quot;textToImage.php?text=emailAddress@emailProvider.com&quot;</span>&gt;</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://readytousesolutions.com/phpblog/php-tutorial-write-text-and-convert-into-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

