<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[在php中动态生成不同字体颜色的png格式验证图片]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[代码编程]]></category>
<pubDate>Tue, 03 Oct 2006 00:14:39 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	<div class="code"><br/>&lt;?<br/>session_start();<br/>//生成验证码图片 <br/>Header(&quot;Content-type: image/PNG&quot;); <br/>$authnum=$_SESSION&#91;&quot;authnum&quot;&#93;;<br/>srand((double)microtime()*1000000); <br/>$len = strlen($authnum)*12+10;<br/>$im = imagecreate($len,25); <br/>$color&#91;&#93;= array ();<br/>$color&#91;1&#93; = ImageColorAllocate($im, 0x00,0x00,0x00);<br/>$color&#91;2&#93; = ImageColorAllocate($im, 0x00,0x00,0xff);<br/>$color&#91;3&#93; = ImageColorAllocate($im, 0xff,0x33,0x00);<br/>$color&#91;4&#93; = ImageColorAllocate($im, 0x00,0x00,0x99);<br/>$color&#91;5&#93; = ImageColorAllocate($im, 0xff,0x00,0xff);<br/>$color&#91;6&#93; = ImageColorAllocate($im, 0x99,0x66,0xff);<br/>$color&#91;7&#93; = ImageColorAllocate($im, 0x00,0x99,0x99);<br/>$color&#91;8&#93; = ImageColorAllocate($im, 0xff,0xff,0x00);<br/><br/>if($background)<br/>&#123;<br/> $r = substr($background, 0, 2);<br/> $g = substr($background, 2, 2);<br/> $b = substr($background, 4, 2);<br/> $bg = ImageColorAllocate($im, hexdec(&quot;0x&quot;.$r),hexdec(&quot;0x&quot;.$g),hexdec(&quot;0x&quot;.$b)); <br/>&#125;<br/>else<br/>&#123;<br/> $bg = ImageColorAllocate($im, 0xcc,0xcc,0xff); <br/>&#125;<br/>imagefill($im, 0, 0, $bg); <br/><br/>for($i=0,$x=5;$i&lt;strlen($authnum);$i++)<br/>&#123;<br/> imagestring($im, 5, $x, rand(2,8), $authnum&#91;$i&#93;, $color&#91;rand(1,8)&#93;); <br/> $x+=12;<br/>&#125;<br/>for($i=0;$i&lt;100;$i++) &nbsp; //加入干扰象素 <br/>&#123; <br/> &nbsp; &nbsp;$randcolor = ImageColorallocate($im,rand(100,255),rand(100,255),rand(100,255));<br/> &nbsp; &nbsp;imagesetpixel($im, rand()%$len , rand()%30 , $randcolor); <br/>&#125;<br/>ImagePNG($im);<br/>ImageDestroy($im);<br/>?&gt;<br/><br/><br/><br/></div>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] 在php中动态生成不同字体颜色的png格式验证图片]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>