<?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>邪罗刹的菠萝阁 &#187; image</title>
	<atom:link href="http://www.evlos.org/tag/image/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evlos.org</link>
	<description>A straw shows which way the wind blows ..</description>
	<lastBuildDate>Thu, 09 Sep 2010 13:27:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>一个PR图片调用API与查询的程序</title>
		<link>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/</link>
		<comments>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 21:33:52 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1945</guid>
		<description><![CDATA[> 嘿嘿，这个是 超人 特别版喔，送给超人童鞋。并附带用户查询界面，为其中的 Index.php 文件。 > 最近觉得 Google 很厚道，日历 阅读器 GMail GoogleCode Appengine 等一系列服务都很不错。 > 很爽，嘻嘻 O(∩_∩)O。最近打算搞一个 VPS 之类的有更大流量的东东来玩，嘎嘎，春哥保佑。 > 迟一些再发布 AlexImgAPI V1.0.0 吧，其实是还没有完成啦 ╮(╯▽╰)╭，还是代码丢失的老原因。 一. GooglePRImgAPI V1.0.0： > 下面两幅图分别是 Index.php 和 Pr.php 的浏览图，请注意 Index.php 是依赖于 Pr.php 的喔。 > 下载 - http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip 二. 附言： > 嘿嘿，因为超人童鞋急需，所以先发布这篇，下篇将发布《WP用于围观某评论者发言的插件》。 > 刚刚到手了 Zxc.im nnd.im，嘎嘎嘎，第一个网址是键盘上顺序按键，第二个是NND，O(∩_∩)O。]]></description>
			<content:encoded><![CDATA[<p>> 嘿嘿，这个是 <a target='_blank' rel='nofollow' href='http://www.superm.org/'>超人</a> 特别版喔，送给超人童鞋。并附带用户查询界面，为其中的 Index.php 文件。<br />
> 最近觉得 Google 很厚道，日历 阅读器 GMail GoogleCode Appengine 等一系列服务都很不错。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000254.png' /></p>
<p>> 很爽，嘻嘻 O(∩_∩)O。最近打算搞一个 VPS 之类的有更大流量的东东来玩，嘎嘎，春哥保佑。<br />
> 迟一些再发布 AlexImgAPI V1.0.0 吧，其实是还没有完成啦 ╮(╯▽╰)╭，还是代码丢失的老原因。</p>
<p><span id="more-1945"></span><strong>一. GooglePRImgAPI V1.0.0：</strong></p>
<p>> 下面两幅图分别是 Index.php 和 Pr.php 的浏览图，请注意 Index.php 是依赖于 Pr.php 的喔。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000255.png' /></p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000256.png' /></p>
<p>> 下载 - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip</a></p>
<p><strong>二. 附言：</strong></p>
<p>> 嘿嘿，因为超人童鞋急需，所以先发布这篇，下篇将发布《WP用于围观某评论者发言的插件》。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000260.png' /></p>
<p>> 刚刚到手了 Zxc.im nnd.im，嘎嘎嘎，第一个网址是键盘上顺序按键，第二个是NND，O(∩_∩)O。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/feed/</wfw:commentRss>
		<slash:comments>180</slash:comments>
		</item>
		<item>
		<title>使用jQuery添加图片载入提示</title>
		<link>http://www.evlos.org/2009/12/27/images-loading/</link>
		<comments>http://www.evlos.org/2009/12/27/images-loading/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 04:18:43 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[jQuery [Play jQuery]]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[loading]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1854</guid>
		<description><![CDATA[> 因为不可抗拒的因素，小邪昨天下午和今天上午都在离地球上最近的电脑有11公里的地方。 > 终于，在春哥的保佑之下，小邪终于在今天下午回到了我可爱的电脑面前。 > 呵呵，这篇文章讲的东西灰常简单，因为昨天没法一日一博，只好今天早晚各一篇。 > 以弥补各位看官受伤的心灵，小邪可是很善良的喔 (*^__^*) ，哇卡卡卡卡 O(∩_∩)O。 1. 图片载入提示 Demo 传送门： > 小邪已经使用 Opera Safari Firefox Chrome IE6 测试过图片载入提示的代码了。 > 现在浏览器缓存机制十分强大，所以如果想多次浏览，请使用 Ctrl+F5 无缓存刷新。 > 额，这个快捷键在 FF 里是可以用的，其他浏览器小邪就不清楚咯。 > http://www.evlos.org/ev-box/demo/images_loading 2. 当然要先载入 jQuery 库： > 呵呵，这是为新来的童鞋提供的步骤，老童鞋就请直接跳过咯。 > 貌似原来的 lastest.js 不见了，可能太多人载入这个文件，官方服务器挺不住。 > 所以这个还是在 Google 服务器上托管的 JS 文件，请放心使用 O(∩_∩)O。 1 2 &#60;script type=&#34;text/javascript&#34; src=&#34;http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js&#34;&#62;&#60;/script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>> 因为不可抗拒的因素，小邪昨天下午和今天上午都在离地球上最近的电脑有11公里的地方。<br />
> 终于，在春哥的保佑之下，小邪终于在今天下午回到了我可爱的电脑面前。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture09391.jpg" /></p>
<p>> 呵呵，这篇文章讲的东西灰常简单，因为昨天没法一日一博，只好今天早晚各一篇。<br />
> 以弥补各位看官受伤的心灵，小邪可是很善良的喔 (*^__^*) ，哇卡卡卡卡 O(∩_∩)O。</p>
<p><span id="more-1854"></span><strong>1. 图片载入提示 Demo 传送门：</strong></p>
<p>> 小邪已经使用 Opera Safari Firefox Chrome IE6 测试过图片载入提示的代码了。<br />
> 现在浏览器缓存机制十分强大，所以如果想多次浏览，请使用 Ctrl+F5 无缓存刷新。<br />
> 额，这个快捷键在 FF 里是可以用的，其他浏览器小邪就不清楚咯。</p>
<p>> <a target="_blank" href="http://www.evlos.org/ev-box/demo/images_loading">http://www.evlos.org/ev-box/demo/images_loading</a></p>
<p><strong>2. 当然要先载入 jQuery 库：</strong></p>
<p>> 呵呵，这是为新来的童鞋提供的步骤，老童鞋就请直接跳过咯。<br />
> 貌似原来的 lastest.js 不见了，可能太多人载入这个文件，官方服务器挺不住。<br />
> 所以这个还是在 Google 服务器上托管的 JS 文件，请放心使用 O(∩_∩)O。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span>
src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><strong>3. 然后载入图片Loading提示的 jQuery 插件：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">LoadImage</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>settings<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
settings <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> scaling <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
width <span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span>height <span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span>loadpic<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> settings<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">LoadImage</span>.<span style="color: #660066;">Showimg</span><span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> settings <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">LoadImage</span>.<span style="color: #660066;">Showimg</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$this<span style="color: #339933;">,</span> settings<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> src<span style="color: #339933;">=</span>$this.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> img<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
img.<span style="color: #660066;">src</span><span style="color: #339933;">=</span>src<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> autoScaling<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>settings.<span style="color: #660066;">scaling</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> img.<span style="color: #660066;">height</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span> <span style="color: #009966;">/ img.height &gt;= settings.width /</span> settings.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span> <span style="color: #339933;">&gt;</span> settings.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
$this.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>settings.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">height</span> <span style="color: #339933;">*</span> settings.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> img.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
$this.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">height</span> <span style="color: #339933;">&gt;</span> settings.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
$this.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>settings.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span> <span style="color: #339933;">*</span> settings.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
$this.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
$this.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> loading<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;img alt=<span style="color: #000099; font-weight: bold;">\&quot;</span>加载中...<span style="color: #000099; font-weight: bold;">\&quot;</span> title=<span style="color: #000099; font-weight: bold;">\&quot;</span>图片加载中...<span style="color: #000099; font-weight: bold;">\&quot;</span> src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
<span style="color: #339933;">+</span>settings.<span style="color: #660066;">loadpic</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">after</span><span style="color: #009900;">&#40;</span>loading<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
autoScaling<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
loading.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">src</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$this.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><strong>4. 设置此 jQuery 插件的参数：</strong></p>
<p>> Loadpic 是设置提示图片的路径，宽度高度就不用管它了。<br />
> 这个宽度高度是图片最大高和图片最大宽，按比例缩放的，不过我们用不到。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">LoadImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>scaling <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
			width <span style="color: #339933;">:</span> <span style="color: #CC0000;">3000</span><span style="color: #339933;">,</span>
			height <span style="color: #339933;">:</span> <span style="color: #CC0000;">3000</span><span style="color: #339933;">,</span>
			loadpic<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;imgload.gif&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2009/12/27/images-loading/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>制作好一个输出Alex排名图片的API</title>
		<link>http://www.evlos.org/2009/12/14/made-a-api-can-output-alex-image/</link>
		<comments>http://www.evlos.org/2009/12/14/made-a-api-can-output-alex-image/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 07:50:07 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[alex]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1589</guid>
		<description><![CDATA[> 嘿嘿，这个应该没有其他的人做了吧，独家喔。小邪昨天一直在做这个呢，O(∩_∩)O。 > 很方便的调用，说明在图片上，Type=2 则是提供此网站在其所属国家的排名。 > 记得要加 Url= 喔，不必使用 Http 开头的地址。只支持 6 位数排名，超过则显示无限。 > 正在制作缓存机制，尚未完成喔，缓存时间定为 3 天，这样就不必每次都到官方获取数据咯。 > 预览传送门：http://tool.evlos.org/aleximg/ 1. PHP 中的字符串与数字： > 在 PHP 里，字符串和数字之间是无需转换的，因为它会自动完成这个操作。 > ╮(╯▽╰)╭，我感觉我解脱了，以前在 Delphi 里为了个类型转换就要纠结死，差点就升天了。 1 2 3 4 5 6 &#60;?php $j = &#34;10&#34;; for &#40;$i=1; $i&#60;=$j; $i++&#41; &#123; echo $i; &#125; ?&#62; > 像在 For 循环里，$i 是数字，%j 是字符串，这里就可以直接用啦。 [...]]]></description>
			<content:encoded><![CDATA[<p>> 嘿嘿，这个应该没有其他的人做了吧，独家喔。小邪昨天一直在做这个呢，O(∩_∩)O。<br />
> 很方便的调用，说明在图片上，Type=2 则是提供此网站在其所属国家的排名。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0785.jpg" /></p>
<p>> 记得要加 Url= 喔，不必使用 Http 开头的地址。只支持 6 位数排名，超过则显示无限。<br />
> 正在制作缓存机制，尚未完成喔，缓存时间定为 3 天，这样就不必每次都到官方获取数据咯。</p>
<p><span id="more-1589"></span>> 预览传送门：<a target="_blank" href="http://tool.evlos.org/aleximg/">http://tool.evlos.org/aleximg/</a></p>
<p>1. <strong>PHP 中的字符串与数字</strong>：</p>
<p>> 在 PHP 里，字符串和数字之间是无需转换的，因为它会自动完成这个操作。<br />
> ╮(╯▽╰)╭，我感觉我解脱了，以前在 Delphi 里为了个类型转换就要纠结死，差点就升天了。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;10&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$j</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>> 像在 For 循环里，$i 是数字，%j 是字符串，这里就可以直接用啦。<br />
> 因为加好是针对数值的，点才是针对字符串的。数值上来说 'aass' = 0。<br />
> 所以下面输出的 $i 和 $j 的计算结果都是 1。而 $k 和 $l 都是 1112。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'aass'</span><span style="color: #339933;">+</span><span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'aass'</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1111'</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$l</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1111'</span><span style="color: #339933;">+</span><span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$j</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$k</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>2. <strong>Url 地址传递参数</strong>：</p>
<p>> 这是一个很方便的功能，不需要表单来引导，但请勿用来传递密码喔。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #096;">//tool.evlos.org/aleximg/get.php?url=verycd.com&amp;type=2</span></pre></td></tr></table></div>

<p>> 这里我就可以使用 $_GET['type'] 来获得需要的参数。<br />
> 记得使用 isset 函数判断参数是否存在喔，不进行判断的话会运行出错的</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$output_type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$output_type</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>3. <strong>Strip_tags 函数</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0783.jpg" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;p&gt;test&lt;/p&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$nop</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 这个函数去除 HTML 标签的能力很强悍的说，这样就直接变成了 'test' 啦，O(∩_∩)O。</p>
<p>4. <strong>对中文字符串的支持</strong>：</p>
<p>> 这个支持灰常好，可以像下面的代码一样直接用呢 (^o^)。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$global_num</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'无数据'</span><span style="color: #339933;">||</span>strlen<span style="color: #009900;">&#40;</span><span style="color: #000088;">$global_num</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$pic</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;img/global_unlimited.gif&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pic</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: image/jpeg; charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$pic_num</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	output_pic<span style="color: #009900;">&#40;</span><span style="color: #000088;">$global_num</span><span style="color: #339933;">,</span><span style="color: #000088;">$output_type</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>> 第一次写了 167 行的代码，嘿嘿，记录一下。</p>
<p>5. <strong>使用  PHP 合并数字图片</strong>：</p>
<p>> 呵呵，当时为了自己好理解，而且数量不多，所以在这里就没有使用循环和数组咯。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$source_img1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$source_img1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img3</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img3</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img4</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img4</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img6</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_emp.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$source_img6</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'img/num_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$num_cut</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.gif'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>6 .<strong>请注意一下</strong>：</p>
<p>> 如果有哪个童鞋打算长期使用，请一定要和我说一声。<br />
> 有出现某些不得不做改动的情况的话，我会立即通知你做修改的。<br />
> 还有使用了我的 PR 调用的童鞋也麻烦吱我一声，谢谢支持。</p>
<p>7. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2009/12/14/made-a-api-can-output-alex-image/feed/</wfw:commentRss>
		<slash:comments>64</slash:comments>
		</item>
		<item>
		<title>如何使用PHP来合并图片</title>
		<link>http://www.evlos.org/2009/12/13/merge-images-by-php/</link>
		<comments>http://www.evlos.org/2009/12/13/merge-images-by-php/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 10:34:31 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[PHP编程 [PHP Build]]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1591</guid>
		<description><![CDATA[> 最近小邪玩了一下PHP，很不错，代码的可读性很高，如果有兴趣学习其实也不是很难的。 > 话说上次做了一个直接提供PR图片的API，蛮不错的，但是看 Webmasterhome 已经有了。 > 还以为白做了呢，不过发现那个貌似没用掉了，怎么样都不肯显示，所以，嘿嘿嘿嘿。 > 这次打算做另外一个API，需要用到图片合并功能，O(∩_∩)O，先保密，下篇文章揭晓喔。 1. Image 图像函数说明： 2. Image 图像函数所支持的图像格式： 3. 合并图像所需函数： > Getimagesize - 取得图像大小 > Imagecreatefromgif - 从 GIF 文件或 URL 新建一图像 > Imagecreatefromjpeg - 从 JPEG 文件或 URL 新建一图像 > Imagecreatefrompng - 从 PNG 文件或 URL 新建一图像 > Imgcopy - 拷贝图像的一部分 > Imagegif - 以 GIF [...]]]></description>
			<content:encoded><![CDATA[<p>> 最近小邪玩了一下PHP，很不错，代码的可读性很高，如果有兴趣学习其实也不是很难的。<br />
> 话说上次做了一个<a target="_blank" href="http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/">直接提供PR图片的API</a>，蛮不错的，但是看 Webmasterhome 已经有了。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/snouuuu-1.jpg" /></p>
<p>> 还以为白做了呢，不过发现那个貌似没用掉了，怎么样都不肯显示，所以，嘿嘿嘿嘿。<br />
> 这次打算做另外一个API，需要用到图片合并功能，O(∩_∩)O，先保密，下篇文章揭晓喔。</p>
<p><span id="more-1591"></span>1. <strong>Image 图像函数说明</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0768.jpg" /></p>
<p>2. <strong>Image 图像函数所支持的图像格式</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0769.jpg" /></p>
<p>3. <strong>合并图像所需函数</strong>：</p>
<p>> Getimagesize - 取得图像大小<br />
> Imagecreatefromgif - 从 GIF 文件或 URL 新建一图像<br />
> Imagecreatefromjpeg - 从 JPEG 文件或 URL 新建一图像<br />
> Imagecreatefrompng - 从 PNG 文件或 URL 新建一图像</p>
<p>> Imgcopy - 拷贝图像的一部分</p>
<p>> Imagegif - 以 GIF 格式将图像输出到浏览器或文件<br />
> Imagejpeg - 以 JPEG 格式将图像输出到浏览器或文件<br />
> Imagepng - 以 PNG 格式将图像输出到浏览器或文件</p>
<p>4. <strong>Imgcopy 函数详解</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0770.jpg" /></p>
<p>5. <strong>PHP header() 函数详解</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0771.jpg" /></p>
<p>6. <strong>首先要将图片载入字符串中</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/snow1.jpg" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$source</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1.png'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$source1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'2.png'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$target</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'emp.png'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$source_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$source_img1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$target_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 首先定义图像的地址为变量以作为 Imagecreatefrompng 函数的参数。<br />
> 当然直接把地址填到函数里也行的，我这样做是我博客页面宽度不够嘛，呵呵。<br />
> 记得直接填写的时候要加上俩个引号在两边喔，我个人比较喜欢单引号，忌混用。</p>
<p>> 当然 Imagecreatefromgif 和 Imagecreatefrompng 也是可以用的喔。<br />
> 这就要看你要处理哪种格式的图像咯，风景方面我比较看中画质，所以用 PNG。</p>
<p>> Emp.Png 是一张完全空白的图片，大小为两个来源图之和，为我们合并其他图像做准备。<br />
> 当然也可以不用，用函数创建一个，但是从学习角度来说，这样子应该容易理解一点。<br />
> 然后 1.Png 2.Png 两个文件是要被合并的图片。</p>
<p>7. <strong>开始横向合并图像</strong>：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$size1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">imagecopy</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$target_img</span><span style="color: #339933;">,</span><span style="color: #000088;">$source_img</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagecopy</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$target_img</span><span style="color: #339933;">,</span><span style="color: #000088;">$source_img1</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$size1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$size1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 用 Getimagesize 函数获得图像的尺寸，产生的是一个数组，$size[0]是宽，$size[1]是高。<br />
> 我们把 Source_img 放到 Target_img 的左上角，坐标为 0：0 的位置。<br />
> 然后把 Source_img1 放到 Target_img 中 Source_img 的右边。<br />
> 所以横坐标为 Source_img 的宽度。</p>
<p>8. <strong>生成或者打印图像</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/ssss-1.jpg" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$target_img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 在这里说的打印当然不是用打印机咯，呵呵，是显示在你的屏幕上。<br />
> 先使用 Header 函数向客户端发送原始的 HTTP 报头，告诉他你这个图片是PNG格式。<br />
> 然后使用 imagepng 输出即可，就会显示在屏幕上咯，可以右键另存为来着，嘿嘿。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$target_img</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'3.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 当然也可以保存为文件呢，这样就好咯，相对路径也没问题的喔。</p>
<p>> O(∩_∩)O，其实写博有利于学习，你要让别人听懂，自己就一定要弄透彻，才能讲解出来。</p>
<p>9. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong> 。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2009/12/13/merge-images-by-php/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>制作好一个输出PR图片的API</title>
		<link>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/</link>
		<comments>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 06:35:07 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1490</guid>
		<description><![CDATA[> ╮(╯▽╰)╭ 昨天白夜三更写的，糊涂地忘记了已经有蛮多网站提供这个功能了，结果就杯具了。 > 不过也没什么，这篇文章刚刚好总结一下 Curl 函数和 File_get_contents 函数的用法。 > 好多服务器为了防采集都禁止 File_get_contents，所以介绍一下俩函数互相替代的方法。 > 话说，昨天给 619 的模板导航栏上加上了分类目录的显示，但我觉得那个模板的函数有点奇怪。 P.s. 呵呵，使用方法如图，作为图片显示即可，有兴趣的童鞋可以调用过去玩玩 O(∩_∩)O。 1. File_get_contents 函数： > 使用如下的代码可以将变量 $GontenPRURL 里的路径指向的文件读入字符串 $filecontent 中。 > 只要在 Url 中传递参数即可到 Google 获取到 PR 的数值，然后转换为相对的图片文件名称。 1 $filecontent = file_get_contents&#40;$prurl&#41;; > 我简单的使用下面的函数代码过滤了一下 Url 地址。 > 因为没法过滤引号，所以后面再使用 Preg_match 的正则式过滤文件头。 1 2 $evlos_re = array&#40;&#34;\&#34;&#34;,&#34;'&#34;,&#34;!&#34;,&#34;@&#34;,&#34;#&#34;,&#34;$&#34;,&#34;%&#34;,&#34;^&#34;,&#34;&#38;&#34;,&#34;*&#34;,&#34;(&#34;,&#34;)&#34;,&#34;+&#34;,&#34;=&#34;&#41;; $website = [...]]]></description>
			<content:encoded><![CDATA[<p>> ╮(╯▽╰)╭ 昨天白夜三更写的，糊涂地忘记了已经有蛮多网站提供这个功能了，结果就杯具了。<br />
> 不过也没什么，这篇文章刚刚好总结一下 Curl 函数和 File_get_contents 函数的用法。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0704.jpg" /></p>
<p>> 好多服务器为了防采集都禁止 File_get_contents，所以介绍一下俩函数互相替代的方法。<br />
> 话说，昨天给 619 的模板导航栏上加上了分类目录的显示，但我觉得那个模板的函数有点奇怪。</p>
<p>P.s. 呵呵，使用方法如图，作为图片显示即可，有兴趣的童鞋可以调用过去玩玩 O(∩_∩)O。</p>
<p><span id="more-1490"></span>1. <strong>File_get_contents 函数</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0703.jpg" /></p>
<p>> 使用如下的代码可以将变量 $GontenPRURL 里的路径指向的文件读入字符串 $filecontent 中。<br />
> 只要在 Url 中传递参数即可到 Google 获取到 PR 的数值，然后转换为相对的图片文件名称。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$filecontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$prurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 我简单的使用下面的函数代码过滤了一下 Url 地址。<br />
> 因为没法过滤引号，所以后面再使用 Preg_match 的正则式过滤文件头。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$evlos_re</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;!&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;@&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;^&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;+&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$website</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$evlos_re</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$website</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 最后再输出一个文件头，再把作为字符串的图片接着输出即可。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: image/jpeg; charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>2. <strong>Curl 函数</strong>：</p>
<p>> <strong>注意！！</strong>CURLOPT_URL 参数是不支持相对路径的，网上没看到有人提到，害我差点没折腾挂掉。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeout1</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$prurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #000088;">$timeout1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$filecontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 这里就得用那么长的代码来代替上面 File_get_contents 函数的那一行代码了。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$fixurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fixurl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$fixurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pic</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fixurl</span><span style="color: #339933;">.</span><span style="color: #000088;">$pic</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> $pic 是我的 PR 图片文件，这里通过上面代码把相对路径转换为 Url 路径。<br />
> 最后也差不多，输出一个文件头，再把作为字符串的图片接着输出即可。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeout2</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$pic</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #000088;">$timeout2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>3. <strong>同行输出日志分类与博客页面列表</strong>：</p>
<p>> 话说原先 Sandbox 只输出博客页面列表的时候 Header.php 只调用了一个函数：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> sandbox_globalnav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>> 然后在主题函数 Functions.php 里面加了一大段这个代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sandbox_globalnav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> 
wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=&amp;sort_column=menu_order&amp;echo=0'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div id=&quot;menu&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'globalnav_menu'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$menu</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>> 我觉得其实没啥必要的样子，因为下面使用 WP 自带的函数输出一个 Li 列表也是可以达到相同效果的。<br />
> 博客页面是 Wp_list_pages，文章分类是 Wp_list_categories。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;menu&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=0&amp;orderby=name&amp;show_count=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=0&amp;sort_column=menu_order'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></td></tr></table></div>

<p>> 然后在 CSS 文件里面把 Li 变成行内元素即可，话说 Li 真是一个神奇的东西。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> li <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>4. <strong>调用说明页面传送门</strong>：</p>
<p>> <a target="_blank" href="http://tool.evlos.org/primg/">http://tool.evlos.org/primg/</a></p>
<p>5. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong> 。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
	</channel>
</rss>
