<?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>David Scott Tufts &#187; GD Library</title>
	<atom:link href="http://www.davidscotttufts.com/tag/gd-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidscotttufts.com</link>
	<description>Husband, Father of Six, and Web Developer</description>
	<lastBuildDate>Thu, 18 Mar 2010 16:26:33 +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>How To Create Barcodes in PHP</title>
		<link>http://www.davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/</link>
		<comments>http://www.davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 19:59:55 +0000</pubDate>
		<dc:creator>David Scott Tufts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Barcode]]></category>
		<category><![CDATA[GD Library]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.davidscotttufts.com/?p=4</guid>
		<description><![CDATA[A few years ago I needed a way to generate barcodes on-the-fly using PHP, at the time there were several solutions available at a steep cost, so I wrote this script that generates barcodes in four barcode formats including Code 128, Code 39, Code 2of5, and Codabar.  With a little over 100 lines of [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago I needed a way to generate barcodes on-the-fly using PHP, at the time there were several solutions available at a steep cost, so I wrote this script that generates barcodes in four barcode formats including Code 128, Code 39, Code 2of5, and Codabar.  With a little over 100 lines of code you have the options of &#8220;vertical&#8221; or &#8220;horizontal&#8221; display, varying barcode heights, and one of four barcode formats.  It does require the <a href="http://www.php.net/gd">GD Library</a> to be installed as a module in PHP.</p>
<p>This code is available for use under the <a href="http://www.opensource.org/licenses/mit-license.html" title="Link to MIT License">MIT License</a></p>
<p>View the code here: <a href="http://www.davidscotttufts.com/code/barcode.phps">http://www.davidscotttufts.com/code/barcode.phps</a></p>
<hr />
<h3>Example 1:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;0&#8243; <strong>(Default)</strong><br />
Size: &#8220;20&#8243; <strong>(Default)</strong><br />
Code Type: &#8220;Code128&#8243; <strong>(Default)</strong><br />
Orientation: &#8220;Horizontal&#8221; <strong>(Default)</strong></p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php&quot; alt=&quot;testing&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php" alt="0" />
</p>
<hr />
<h3>Example 2:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;testing&#8221;<br />
Size: &#8220;20&#8243; <strong>(Default)</strong><br />
Code Type: &#8220;Code128&#8243; <strong>(Default)</strong><br />
Orientation: &#8220;Horizontal&#8221; <strong>(Default)</strong></p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php?text=testing&quot; alt=&quot;testing&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php?text=testing" alt="testing" />
</p>
<hr />
<h3>Example 3:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;TESTING&#8221;<br />
Size: &#8220;40&#8243;<br />
Code Type: &#8220;Code39&#8243;<br />
Orientation: &#8220;Horizontal&#8221; <strong>(Default)</strong></p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php?codetype=Code39&amp;size=40&amp;text=TESTING&quot; alt=&quot;TESTING&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php?codetype=Code39&amp;size=40&amp;text=TESTING" alt="TESTING" />
</p>
<hr />
<h3>Example 4:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;12345&#8243;<br />
Size: &#8220;40&#8243;<br />
Code Type: &#8220;Code25&#8243;<br />
Orientation: &#8220;Horizontal&#8221; <strong>(Default)</strong></p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php?codetype=Code25&amp;size=40&amp;text=12345&quot; alt=&quot;12345&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php?codetype=Code25&amp;size=40&amp;text=12345" alt="12345" />
</p>
<hr />
<h3>Example 5:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;123ABC&#8221;<br />
Size: &#8220;40&#8243;<br />
Code Type: &#8220;Codabar&#8221;<br />
Orientation: &#8220;Horizontal&#8221; <strong>(Default)</strong></p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php?codetype=Codabar&amp;size=40&amp;text=123ABC&quot; alt=&quot;123ABC&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php?codetype=Codabar&amp;size=40&amp;text=123ABC" alt="123ABC" />
</p>
<hr />
<h3>Example 6:</h3>
<p>
<strong>Parameters:</strong><br />
Text: &#8220;The Real David Tufts&#8221;<br />
Size: &#8220;40&#8243;<br />
Code Type: &#8220;Code128&#8243; <strong>(Default)</strong><br />
Orientation: &#8220;Vertical&#8221;</p>
<p><strong>HTML Source Code:</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;img src=&quot;/code/barcode.php?text=The%20Real%20David%20Tufts&amp;orientation=vertical&amp;size=40&quot; alt=&quot;The Real David Tufts&quot; /&gt;</div>
</li>
</ol>
</div>
<p><strong>Result:</strong><br />
<img src="/code/barcode.php?text=The%20Real%20David%20Tufts&amp;orientation=vertical&amp;size=40" alt="The Real David Tufts" />
</p>
<hr />
<p>Please leave comments with additions or improvements to this script.  One possible area of improvement for Code 128 is figuring out how to add keyboard commands (i.e. SHIFT, DEL, FNC 1, etc.) to the barcode.</p>
<p>Again, you can view the code here: <a href="http://www.davidscotttufts.com/code/barcode.phps">http://www.davidscotttufts.com/code/barcode.phps</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
