[插件名称]:自动在线播放多媒体附件文件
[适用版本]:Discuz! 5.0.0
[插件原作者]:Oytktk(靖飒)
[发布日期]:2006-4-15
[插件优化]:老牛
[发布日期]:2007-3-1
[插件用途]:将会员上传到论坛上的音乐或视频类型的附件文件以播放器播放的形式体现在页面上.
一、需要修改的文件列表:
1、模板(viewthread.htm)
2、viewthread.php
二、修改文件完毕并上传至您的服务器以后,您将需要在您的后台“更新缓存”方可使用!
三、优化了什么?
1、原帖写的是针对 4.0版本, 在查找原内容时,如果按照原帖的说明,在 5.0版本里找不到完全一样的内容。
初学者不知道应该改哪些部分。
优化:下面内容已针对 5.0版本进行了修改,初学者也能找到相关内容,并能修改成功。
2、原插件在设计播放画面时,未区分视频文件和音频文件。比如,在播放MPG文件和播放MP3文件时,
都是适合播放视频文件的大画面,显得不是很适合。
优化:针对 MPG等视频文件和针对MP3等音频文件,在播放时使用不同的画面大小,使得简洁。
3、自动开始:预设值改为“手动”开始。
5.0版本,可以发表多附件帖。 如果附件都是多媒体文件,设置为“自动开始播放”时,将引起“合唱”的效果。
也影响速度。所以改为“手动播放”。
如果需要,也可把预设值改为“自动开始播放”
将模板(viewthread.htm)的修改部分中的 <PARAM NAME="AUTOSTART" VALUE="0"> (一共有4处)
改为 <PARAM NAME="AUTOSTART" VALUE="-1">
方法:
1. 修改模板(viewthread.htm)
查找:
- <br><br>$attach[attachicon]
- <!--{if $attach['attachimg']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
- <!--{if $attachrefcheck}-->
- <img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}" onmousewheel="return imgzoom(this);" alt="" />
- <!--{else}-->
- <img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);" alt="" />
- <!--{/if}-->
复制代码
替换为:
- <br><br>$attach[attachicon]
- <!--{if $attach['attachimg']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
- <!--{if $attachrefcheck}-->
- <img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}" onmousewheel="return imgzoom(this);">
- <!--{else}-->
- <img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);">
- <!--{/if}-->
- <!--{elseif $attach['attachwmv']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">影音附件</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
- <object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="450" height="340" ><PARAM NAME="AUTOSTART" VALUE="0"><param name="ShowStatusBar" value="-1"><param name="Filename" value="attachment.php?aid=$attach[aid]&noupdate=yes">
- <embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="attachment.php?aid=$attach[aid]&noupdate=yes" width="420" height="340"></embed></object>
- <!--{elseif $attach['attachmp3']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">影音附件</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
- <object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="450" height="73" ><PARAM NAME="AUTOSTART" VALUE="0"><param name="ShowStatusBar" value="-1"><param name="Filename" value="attachment.php?aid=$attach[aid]&noupdate=yes">
- <embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="attachment.php?aid=$attach[aid]&noupdate=yes" width="420" height="73"></embed></object>
- <!--{elseif $attach['attachrm']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">影音附件</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
- <object width="420" height="280" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="Player_name" viewastext>
- <param name="Autostart" value="0"><param name="CONTROLS" value="ImageWindow"><param name="CONSOLE" value="_master">
- <param name="LOOP" value="0"><param name="CENTER" value="0"><param name="_ExtentX" value="9525"><param name="_ExtentY" value="7938"><param name="SHUFFLE" value="0">
- <param name="PREFETCH" value="0"><param name="NOLABELS" value="0"><param name="NUMLOOP" value="0"><param name="MAINTAINASPECT" value="0"><param name="BACKGROUNDCOLOR" value="#000000">
- </object><br><object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=68 width="420" VIEWASTEXT>
- <param name="_ExtentX" value="9525"><param name="_ExtentY" value="1693"><param name="Autostart" value="0"><param name="LOOP" value="0"><param name="CENTER" value="0">
- <param name="SRC" value="{$attachurl}\{$attach[attachment]}"><param name="SHUFFLE" value="0"><param name="PREFETCH" value="0"><param name="NOLABELS" value="0"><param name="NUMLOOP" value="0"><param name="MAINTAINASPECT" value="0">
- <param name="BACKGROUNDCOLOR" value="#000000"></object>
复制代码
2. 修改 (viewthread.php)
查找:
- $attach['attachimg'] = $showimages && $attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
复制代码
下面添加:
- $attach['attachwmv'] = $attachimgpost && in_array($extension, array('avi', 'wmv', 'mpg', 'swf', 'mpeg')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
- $attach['attachmp3'] = $attachimgpost && in_array($extension, array('wav', 'wma', 'mp3', 'mid')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
- $attach['attachrm'] = $attachimgpost && in_array($extension, array('rm', 'rmvb')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
复制代码
3. 到后台“更新缓存”.
4. 完成! |