<?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; avatar</title>
	<atom:link href="http://blog.istef.info/tag/avatar/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.istef.info</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 06 Jun 2010 05:52:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://blog.istef.info/?pushpress=hub'/>
		<item>
		<title>【发布】bbPress 头像插件</title>
		<link>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/</link>
		<comments>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 16:52:47 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[bbpress]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/</guid>
		<description><![CDATA[最近做 bbPress 相关的开发，做了不少的插件来实现我需要的功能，我会陆续将一些好玩的插件分享出来，今天分享的就是 bbPress 头像插件。 bbPress 非常精简，本身并没有头像功能。不过这么好玩的功能一般论坛都需要吧。翻遍了 bbPress 官方论坛，找到几个头像插件，要么利用外部引用图片，要么利用 Gravatar。可我需要的是类似 Discuz 那样的头像上传，只好花点时间自己做一个了，而且实现了一些我需要的功能： 验证上传图片类型，只支持 gif,jpeg,png 格式； 验证上传图片的尺寸； 根据预先设定，生成不同尺寸的正方形头像图片，方便不同地方调用； 您可以通过这里下载 bbPress Avatar Plugin。然后进行如下设置： 改名为 *.php 上传到 my-plugins 目录下； 在 bbPress 目录下建立目录 avatar，并更改权限为可写； 修改模版，在适当的地方添加调用； 对于第三步，其实只是在需要显示头像的地方进行调用，例如需要在文章列表中显示最后回复用户 20*20 的头像，只要在合适位置添加下面的代码： &#60;?php topic_avatar_list(20);?&#62; 在模版 post.php 中，显示每个发帖、回复用户的大头像： &#60;?php post_avatar();?&#62; 在 profile.php 中，用户资料页面用户名左侧显示一个 20*20 的小头像： &#60;?php post_avatar(20,$user-&#62;ID); ?&#62; 是不是很方便？其实可以定义的参数还有很多，您可以打开 avatar.php 参考一下，可以调整的地方均有注释。 btw: 明天就是除夕了，在这里恭祝大家新年快乐，吉祥如意！]]></description>
			<content:encoded><![CDATA[<p><!--SPONSOR=[PAGEFLAKES]-->
<p style="text-indent:0;text-align:center"><img src='http://blog.istef.info/wp-content/uploads/2007/02/2007-2-16.jpg' alt='bbPress Avatar Plugin' /></p>
<p>最近做 bbPress 相关的开发，做了不少的插件来实现我需要的功能，我会陆续将一些好玩的插件分享出来，今天分享的就是 bbPress 头像插件。</p>
<p>bbPress 非常精简，本身并没有头像功能。不过这么好玩的功能一般论坛都需要吧。翻遍了 bbPress 官方论坛，找到几个头像插件，要么利用外部引用图片，要么利用 Gravatar。可我需要的是类似 Discuz 那样的头像上传，只好花点时间自己做一个了，而且实现了一些我需要的功能：</p>
<ul>
<li>验证上传图片类型，只支持 gif,jpeg,png 格式；</li>
<li>验证上传图片的尺寸；</li>
<li>根据预先设定，生成不同尺寸的正方形头像图片，方便不同地方调用；</li>
</ul>
<p>您可以通过这里下载 <a href="http://blog.istef.info/wp-content/plugins/DownloadCounter/download.php?id=4">bbPress Avatar Plugin</a>。然后进行如下设置：</p>
<ol>
<li>改名为 *.php 上传到 my-plugins 目录下；</li>
<li>在 bbPress 目录下建立目录 avatar，并更改权限为可写；</li>
<li>修改模版，在适当的地方添加调用；</li>
</ol>
<p>对于第三步，其实只是在需要显示头像的地方进行调用，例如需要在文章列表中显示最后回复用户 20*20 的头像，只要在合适位置添加下面的代码：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">topic_avatar_list</span><span style="color: Olive;">(</span><span style="color: Maroon;">20</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>在模版 post.php 中，显示每个发帖、回复用户的大头像：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">post_avatar</span><span style="color: Olive;">()</span><span style="color: Gray;">;</span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>在 profile.php 中，用户资料页面用户名左侧显示一个 20*20 的小头像：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">post_avatar</span><span style="color: Olive;">(</span><span style="color: Maroon;">20</span><span style="color: Gray;">,</span><span style="color: #00008b;">$user</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">ID</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>是不是很方便？其实可以定义的参数还有很多，您可以打开 avatar.php 参考一下，可以调整的地方均有注释。</p>
<p>btw: 明天就是除夕了，在这里恭祝大家新年快乐，吉祥如意！
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F17%2Fbbpress-avatar-plugin%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F17%2Fbbpress-avatar-plugin%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 1/9 queries in 0.005 seconds using memcached
Object Caching 311/322 objects using memcached

Served from: blog.istef.info @ 2012-02-13 11:55:02 -->
