适用版本:所有PW版本,本贴以PW4为例
插件作者:
原作者t1000,修改:东升
最后更新:2006-01-05
修改文件:bbscode.php
修改模版:read.htm、readtpl.htm、editor.htm、data\wind_editor.js添加模板:无
安装难易:中
说明:
安装后使用[simg]来显示图片,即使对方服务器采用了防盗链技术,也可以正常显示。
不生成任何临时文件。
基本上php程序部分只负责获取图片,能转移的工作已经转移到客户端。所以,性能是可以接受的。另外,php部分不要求放在本机,放在免费空间也是不错的办法。
演示地址:
http://bbs.laxjyj.com/read.php?tid=9578备注:本插件在发表前已经得原作者同意!安装方法:1、上传压缩包中的getimg.php到主机空间,任意空间即可,假设地址为:
http://site.com/getimg.php2、修改bbscode.php
在if ($allow['pic']){
后面添加
复制代码- if(strpos($message,'[/simg]')!==false || strpos($message,'[/simg]')!==false){
- $message = preg_replace("/\[simg\](.+?)\[\/simg\]/is","<script language='javascript'>GetProtectImg('\\1');</script>",$message);
- }
|
3、修改read.htm
在<!--<?php
$votedb && require_once PrintEot('vote');
print <<<EOT
-->
后面添加
复制代码- <script language=JavaScript>
- function GetProtectImg(u){
- var getu="[url]http://site.com/getimg.php[/url]";//注意:其中getu的值要与getimg.php所在的地址一致。
- var str_a;
- var h;
- var p;
- var path;
- var temp;
- str_a=u.split("http://");
- str_a=str_a[1].split("/");
- h=str_a.shift();
- path='/'+str_a.join('/');
- temp=h.split(':');
- h=temp[0];
- p=(temp[1]!=null) ? temp[1] : 80;
- getu+='?host='+h+'&port='+p+'&path='+path;
- document.write('<img src='+getu+' border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\';}" onmouseover="if(this.resized) this.style.cursor=\'hand\';" onclick="if(this.resized) {window.open(this.src);}">');
- }
- </script>
|
如果论坛用到静态网页,还需要在readtpl.htm模板<body vlink='#333333' link='#333333'>
的后面添加上面的那段代码。
4、添加simg标签
a、修改editor.htm模板
在
<img onClick=images() alt='插入图片' src='$imgpath/post/editor/images.gif' >
后面添加
<img onClick=simg() alt='插入相册图片' src='$imgpath/post/editor/simg.gif' >
b、修改data\wind_editor.js文件
在
function images() {
前面添加
复制代码- function simg(){
- if (helpmode){
- alert('相册图片标记\n插入相册图片\n用法: [simg]http://www.phpwind.net/p_w_picpath/php.gif[/simg]');
- } else if (nomode || document.selection && document.selection.type == "Text") {
- AddTxt="[simg]"+text+"[/simg]";
- AddText(AddTxt);
- } else {
- txt=prompt('相册图片地址',"http://");
- if(txt!=null) {
- AddTxt="[simg]"+txt;
- AddText(AddTxt);
- AddTxt="[/simg]";
- AddText(AddTxt);
- }
- }
- }
|
c、上传标签用到的图片simg.gif到\images\post\editor目录下。

管理提醒: 本帖被 东升 从 站长大本营 移动到本区(2009-02-02)