My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 10, 2009 by zakiyy.yan
Labels: Featured, Phase-Deploy
InstallationManual  

谷歌看图Discuz!插件安装手册

图贴是各社区论坛中的热门内容,谷歌看图Discuz!插件是一个基于Flash技术的丰富互联网应用程序,目的在于给 Discuz!论坛的图贴一个崭新的浏览体验。图贴阅读插件为Discuz!中的图贴提供了一种以图片为中心的视图,用更多的空间更好地集中展示帖子中的图片,精简了和图片无关的信息,使用户更方便地浏览查看帖子中的图片。

安装说明

首先:下载安装包google_photoviewer_discuz.zip。解压安装包得到下列文件:

photoviewer
│  README
│  ...
├─docs
│  ...
└─upload
    │  viewthreadfeed.php
    │  downloadfeed.php
    │  crossdomain.xml
    └─plugins
        └─photoviewer
            │  AC_OETags.js
            │  index.htm
            │  PhotoViewer.php
            │  PhotoViewer.swf
            │  playerProductInstall.swf
            │
            ├─history
            │      history.css
            │      history.js
            │      historyFrame.html
            │
            └─images
                    icon.gif

根据PhotoViewer.swf的部署方式,有两种安装方式可供选择:

本地安装:Discuz!服务器上将同时部署图贴feed生成模块和PhotoViewer.swf文件。该方式需要将解压后得到所有文件全部部署到论坛服务器上,论坛管理者可以修改部分初始参数,但会增加部署难度,占用论坛服务器空间,使用时会占用论坛服务器带宽,并且,如本插件flash文件升级,需要论坛管理者手动升级。

Google App Engine 安装:Discuz!服务器上仅部署图贴feed生成模块,PhotoVieweer.swf将引用App Engine上的文件。这种方式部署简单,flash文件可以自动升级。

第一步

注:

  1. 网站根目录,如您论坛的地址为http://www.abcde.com/bbs/,则网站根目录为论坛根目录的上一级目录,如论坛地址为http://bbs.abcde.com/ ,则网站根目录就是论坛根目录。
  2. 如网站根目录中存在 crossdomain.xml(关于此文件的详细说明可以参考网站控制--策略文件)文件,可修改该文件,在

<cross-domain-policy>
  ...
  ...
</cross-domain-policy>

中间增加一行

<allow-access-from domain="forum-photo-viewer.appspot.com" />

即可。

第二步:对于在Linux上部署的Discuz!,需要正确设置这些文件(viewthreadfeed.php、photoviewer目录及其中文件)的访问权限(例如:777)

第三步:测试图贴摘要URL。

此前部署的viewthreadfeed.php文件的作用是,生成本插件所需的特定格式的图贴摘要。摘要是一个符合RSS规范的XML文档(关于摘要的详细规范可以参考图贴摘要格式规范)。对于论坛里的每个图贴页面,它都能够生成对应的RSS格式摘要。我们可以用以下方式来测试它是否正常工作:例如,对于以下的一个帖子:

http://www.abcde.com/bbs/viewthread.php?tid=30&page=1

可以用这个URL来得到对应的摘要:

http://www.abcde.com/bbs/viewthreadfeed.php?tid=30&page=1

得到的文件为一个满足图贴摘要格式规范的RSS文件。

第四步:在论坛中加入打开此插件的链接,如果按照上述方式安装。

  • 本地安装:则谷歌看图插件的链接为
  • <论坛域名及路径>/plugins/photoviewer/PhotoViewer.php?photoFeedUrl=<图贴摘要URL>
  • App Engine安装:则谷歌看图插件的链接为
  • http://forum-forum-photo-viewer.appspot.com/?photoFeedUrl=<图贴摘要URL>

<论坛域名及路径> 为论坛的域名及路径,根据您论坛部署的情况,路径可能为根路径或者为您设定的路径,例如 http://www.discuz.net (根路径的情况)或者 http://www.discuz.com/bbs (论坛安装于路径 bbs 下)。

<图贴摘要URL> 指向要被浏览的帖子的RSS摘要,需要经过URI编码(也称为百分号编码)。即参数中的特殊字符,如空格,问号等,需要用%XX的方式代替,其中XX为该字符的ASCII码的十六进制表示。PHP中可以使用rawurlencode 函数对字符进行该编码,关于该编码方式的详细细节,可参考RFC 1738http://en.wikipedia.org/wiki/Percent-encoding

对于链接:

http://www.abcde.com/bbs/viewthreadfeed.php?tid=30&page=1

经过URI编码,应为:

http%3A%2F%2Fwww.abcde.com%2Fbbs%2Fviewthreadfeed.php%3Ftid%3D30%26page%3D1

各位站长可以根据自己站的需求,灵活地在各种位置加入从论坛其他页面到谷歌看图插件的链接。下面给出几种常见做法的例子。

例:在帖子列表页面(forumdisplay.php)中每个帖子标题后面增加一个到图贴阅读器的链接,以默认模板为例。

修改templates/default/forumdisplay.htm,添加链接。首先找到显示每个帖子的代码段(查找<span id="thread_$thread[tid]">,大概位于276行(7.0版本236行)):

…
<!--{/if}-->
<span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra"$thread[highlight]>$thread[subject]</a></span>
<!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
…

然后在其中插入到图贴阅读插件的链接:

  1. 本地安装:
  2. ...
    <!--{/if}-->
    <span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra"$thread[highlight]>$thread[subject]</a></span>
    
    <span>
        <a href="plugins/photoviewer/PhotoViewer.php?photoFeedUrl=..%2F..%2Fviewthreadfeed.php%3Ftid%3D$thread[tid]">
            <img src="plugins/photoviewer/images/icon.gif" class="attach"/></a>
    </span>
    
    <!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
    ...
  3. App Engine安装:
  4. ...
    <!--{/if}-->
    <span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&amp;extra=$extra"$thread[highlight]>$thread[subject]</a></span>
    
    <span>
        <a href="http://forum-photo-viewer.appspot.com/?photoFeedUrl=http%3A%2F%2Fwww.abcde.com%2Fbbs%2Fviewthreadfeed.php%3Ftid%3D$thread[tid]">
            <img src="plugins/photoviewer/images/icon.gif" class="attach"/></a>
    </span>
    
    <!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
    ...

进入帖子列表,即可看到进入图贴阅读插件的链接。如图所示:

点击链接,即可启动此图贴阅读插件。

例:在帖子内容页面(viewthread.php)顶部加入链接,同样以默认模板为例。

首先,编辑templates/default/templates.lang.php,给$language 数组加入一个元素,在文件末尾加入'google_photo_viewer' => '谷歌看图',,该元素指明了链接的文字。

    ...
    'authorinfoitems_location' => '来自',

    'google_photo_viewer' => '谷歌看图',

);

?>

修改templates/default/viewthread.htm。查找<form method="post" name="modactions">,大概位于64行。

...
<form method="post" name="modactions">
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<div class="mainbox viewthread">
		<span class="headactions">
		<!--{if $discuz_uid}-->
			<!--{if $supe['status']}-->
...

span元素下,加入一个链接:

  1. 本地安装:
  2. ...
    <form method="post" name="modactions">
        <input type="hidden" name="formhash" value="{FORMHASH}" />
        <div class="mainbox viewthread">
            <span class="headactions">
                <a href="plugins/photoviewer/PhotoViewer.php?photoFeedUrl=..%2F..%2Fviewthreadfeed.php%3Ftid%3D$tid%26page%3D$page" target="_blank">
                    <img src="plugins/photoviewer/images/icon.gif"/>{lang google_photo_viewer}
                </a>
            <!--{if $discuz_uid}-->
                <!--{if $supe['status']}-->
    ...
  3. App Engine安装:
  4. ...
    <form method="post" name="modactions">
        <input type="hidden" name="formhash" value="{FORMHASH}" />
        <div class="mainbox viewthread">
            <span class="headactions">
                <a href="http://forum-photo-viewer.appspot.com/?photoFeedUr=http%3A%2F%2Fwww.abcde.com%2Fbbs%2Fviewthreadfeed.php%3Ftid%3D$tid%26page%3D$page" target="_blank">
                    <img src="plugins/photoviewer/images/icon.gif"/>{lang google_photo_viewer}
                </a>
            <!--{if $discuz_uid}-->
                <!--{if $supe['status']}-->
    ...
    

结果如图所示。

以上的例子均以默认模板给出,您可以用类似的方法修改其他模板。对于使用FTP方式进行更新的服务器,可以用先将文件下载到本地,修改,然后再上传覆盖的方式进行更新。进行更新前请务必注意备份,以免因更新给网站造成损失。各位站长也可以参照这里的例子,在论坛的其他位置插入至本插件的链接,或动态地根据帖子的内容,决定是否给出链接。

第五步: 插件配置(App Engine方式无此步骤)。

打开plugins/photoviewer/PhotoViewer.php文件,

找到

$tracking = 'true'; // 'true','false'

这个参数是配置是否开启用户统计数据发送功能的。‘true’是开启,'false'为关闭。

再找到

$downloadFeedApi = 'local'; // 'local','appEngine' or user's api

这个参数是配置此插件的下载功能的。'local'是下载时使用本地部署的downloadfeed.php文件为下载api.‘appEngine‘是使用App Engine提供的api进行下载,或者论坛管理者可以使用自己开发的其他api。


Comment by highn...@aobo.com.au, Sep 03, 2008

Very good idea, thanks!!

Comment by 102979...@163.com, Sep 12, 2008

沙发。。thanks~!

http:/BBS.bb-jj.com

Comment by 102979...@163.com, Sep 12, 2008
Comment by holiday100.vip, Sep 18, 2008
Comment by isokyes, Sep 19, 2008

UP.thank you for share,google. demo:hitfeel.com

Comment by udoncn, Sep 20, 2008

支持,等升级上7.0的时候,希望同步支持! http://bbs.udonso.com

Comment by cwg373912629, Sep 21, 2008

支持支持 http://bbs.plu.cn

Comment by rolandyh, Sep 23, 2008

Will it be support Phpwind in the future? 真的很美,很方便。希望将来有Phpwind的版本...

Comment by tooyi2006, Sep 23, 2008

哈哈。。不错不错。。

Comment by wei.safying, Sep 24, 2008

what for? I don't know what's that used for?

Comment by 1793master, Sep 28, 2008
Comment by yanjiecao, Nov 13, 2008

呵呵 谷歌的中国化 很不错的工具

Comment by clin003, Nov 13, 2008

正在测试中 http://bbs.luoyanglife.com/

Comment by hyq12...@sohu.com, Nov 13, 2008

支持一下 7.0要发布了,可以支持吗 测试一下 http://www.ebainet.com/bbs

Comment by clin003, Nov 13, 2008

请提示使用者修改PhotoViewer?.php中的Google统计代码! :P

Comment by beyondhell, Nov 13, 2008

安装好了:

http://www.wlqq.cn

Comment by izhangkun, Nov 14, 2008

google的东西还真是好到爆啊 这次有找到宝了

测试网址:http://www.cnnaicha.com 中国奶茶网

Comment by fudanren.org, Nov 16, 2008

正在测试中 http://fudanren.org/bbs

Comment by qqweb...@126.com, Nov 16, 2008

本站已经安装:

http://www.0759r.com

Comment by FengYX, Nov 16, 2008

for discuz的吗?

有没有把picasa的图片批量发到discuz的插件?

Comment by golyin, Nov 18, 2008

<!--{if $thread'attachment'?}-->

<a href="plugins/photoviewer/PhotoViewer.php?photoFeedUrl=..%2F..%2Fviewthreadfeed.php%3Ftid%3D$thread[tid]" target=_blank>
<img src="plugins/photoviewer/images/icon.gif" class="attach"/></a>
<!--{/if}-->

官方的第一个示例,貌似这样,比较好用一点。大点自己看需不需要。

Comment by lihao677, Nov 18, 2008

支持7.0BETA吗???

Comment by kongsea, Nov 18, 2008

觉得看图没有贴图用着爽,看图也没有贴图的作用大啊。兄弟们觉得呢。呵呵。

Comment by love4pj, Nov 18, 2008

that's perfect!

Comment by iceflame610, Nov 21, 2008

very very good!! http://www.alyssachina.cn

Comment by gzzhoujian, Nov 21, 2008

我是discuz6.1,加入代码,点击链接后,相册能打开,但是显示不出图片,请教解决方法

Comment by dzh006, Nov 22, 2008

不错,哪会装论坛时在安装.http://www.dzh6.com

Comment by bjq1016, Nov 23, 2008

谢谢了 我用一下

Comment by songziho...@163.com, Nov 24, 2008

很不错的软件,我也试用一下! http://bbs.songziniao.com/

Comment by MeigenZh, Nov 24, 2008

我的论坛以贴图为主,放上去测试下, http://www.ameitu.cn/

Comment by heytrip, Nov 24, 2008

我用的是 动易的asp 论坛, 不知google看图能否在次论坛上也开发一下

动易asp论坛在中国的使用量也很大!!

驴友天下 http://bbs.dc1y.cn

Comment by wgllzyl, Nov 30, 2008

能否改一下,在任何程序中都能使用最好了,我的是一个图片站,不知道如何用?www.stylenr.com

Comment by kray.Muzai, Dec 07, 2008

正在安装,http://www.66pai.net

Comment by clin003, Dec 13, 2008

DZ7也可以正常使用 明天看演示 http://bbs.luoyanglife.com/

Comment by atlans2008, Jan 04, 2009

www.fcsns.com/bbs 也在测试中

Comment by clin003, Mar 05, 2009

downloadfeed.php 这个文件啥时候会用到啊,以前版本里都没有的

Comment by clin003, Mar 05, 2009

这个google-photoviewer-discuz_0.2r78.zip 版本有个问题(会在根目录下生成一个“forumdata\feedcaches”命名的文件夹,可以改名后删除),修复办法: http://clin003.com/google/forum-photo-viewer-1655/

Comment by ccc.sino, Mar 14, 2009

请教哪位,我装了之后怎么看不到图片? 地址是:http://www.cn5140.cn/bbs/plugins/photoviewer/PhotoViewer.php?photoFeedUrl=<图贴摘要URL>

Comment by songziho...@163.com, May 18, 2009

准备装一下测试中http://www.fukeask.com

Comment by bigan.cn, May 19, 2009

不知道discuz7.0能用不? 倒是想说在www.lincha.com上使用

Comment by wsfyhy, May 31, 2009

我用DZ7已经装上了,但是有个问题是:为什么每个帖子看图后面会有一些不相关的图片呢?是每个帖子看图后面都有,而且都是一样的,是一些吹琐拉的农民的摄影照片,这些图片绝对不是我的论坛的啊!奇怪!我的论坛地址是:http://www.cuipw.cn 另外,根据我的一个经验,不显示图片内容的解决办法是:将photoFeedUrl的参数改为以http开头的网络路径,不要用站内相对路径!我反正是这么解决的!

Comment by lnesuper, Jun 27, 2009

谷歌看图安装成功(本地安装有不同:[本地安装:把upload\viewthreadfeed.phpl文件上传到论坛的根目录/bbs;将 upload 目录里的upload\crossdomain.xml文件上传到服务器的根目录/bbs;upload\plugins\photoviewer目录(包括其中所有文件)上传到论坛的plugins目录。] ),列表,页面均有谷歌看图链接,但有点遗憾. 所有www开头的网页,本站,或链接其他网站的,均可有效果. 浏览http://gimpbox.com/bbs/thread-45-1-1.html 但没有www看图的网页.无法显示图片. 类似http://gimpbox.com/bbs/thread-89-1-1.html 网站测试 GimpBox

Comment by ngj4...@126.com, Jul 01, 2009

discuz 7.0 图片不显示 怎么回事? http://qv800.cn

Comment by ngj4...@126.com, Jul 01, 2009

discuz 7.0 图片不显示 解决办法!! 打开PhotoViewer?.php 修改这几句 $dot = strrpos($GET'photoFeedUrl'?,'/'); $str_get = substr($GET'photoFeedUrl'?,$dot); //echo $GET'photoFeedUrl'?; $photoFeedUrl = 'http://qv800.cn'.$str_get ;

//$photoFeedUrl = rawurlencode($GET'photoFeedUrl'?); //$photoFeedUrl='http://qv800.cn/viewthreadfeed.php?tid=3730&page=1';

Comment by kelly144...@yahoo.cn, Nov 12, 2009

先试一下,看看效果怎么样www.jshengqun.com


Sign in to add a comment
Hosted by Google Code