找回密码
 注册
查看: 2045|回复: 1
收起左侧

图片失效自动用指定图片代替

[复制链接]

5314

主题

8320

帖子

1万

积分

管理员

出售国内外虚拟空间

Rank: 10Rank: 10Rank: 10

积分
14665
帖子
8320
精华
67
体力
14665 点
蓝豆
2391 点
注册时间
2007-6-8

终身成就奖LY官方团队会员身份ID卡

发表于 2009-4-26 21:58:17 | 显示全部楼层 |阅读模式
第一步:打开templates/Discuzcode.htm 查找
  1. <!--{if $attach[description]}--><p>{$attach[description]}</p><!--{/if}-->
  2. <!--{if !$attach[price] || $attach[payed]}-->
  3. <p>
  4. <!--{if $thumbstatus && $attach[thumb]}-->
  5. <!--{if $attachrefcheck || $hideurl}-->
  6. <a href="javascript:;"><img onclick="zoom(this, attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&fid=$fid&noupdate=yes&nothumb=yes&sid=$sidauth)" src="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&sid=$sidauth" alt="$attach[filename]" /></a>
  7. <!--{else}-->
  8. <a href="javascript:;"><img onclick="zoom(this, $attach[url]/$attach[attachment])" src="$attach[url]/$attach[attachment].thumb.jpg" alt="$attach[filename]"/></a>
  9. <!--{/if}-->
  10. <!--{else}-->
  11. {eval $GLOBALS[aimgs][$attach[pid]][] = $attach[aid];}{eval $widthcode = attachwidth($attach[width]);}
  12. <!--{if $attachrefcheck || $hideurl}-->
  13. <img src="images/common/none.gif" file="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&fid=$fid&noupdate=yes&sid=$sidauth" $widthcode id="aimg_$attach[aid]" alt="$attach[filename]" />
  14. <!--{else}-->
  15. <img src="images/common/none.gif" file="$attach[url]/$attach[attachment]" id="aimg_$attach[aid]" $widthcode alt="$attach[filename]" />
  16. <!--{/if}-->
  17. <!--{/if}-->
复制代码
替换为:
  1. <!--{if $attach[description]}--><p>{$attach[description]}</p><!--{/if}-->
  2. <!--{if !$attach[price] || $attach[payed]}-->
  3. <p>
  4. <!--{if $thumbstatus && $attach[thumb]}-->
  5. <!--{if $attachrefcheck || $hideurl}-->
  6. <a href="javascript:;"><img onclick="zoom(this, attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&fid=$fid&noupdate=yes&nothumb=yes&sid=$sidauth)" src="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&sid=$sidauth" alt="$attach[filename]" onerror="javascript:errpic(this)" /></a>
  7. <!--{else}-->
  8. <a href="javascript:;"><img onclick="zoom(this, $attach[url]/$attach[attachment])" src="$attach[url]/$attach[attachment].thumb.jpg" alt="$attach[filename]" onerror="javascript:errpic(this)" /></a>
  9. <!--{/if}-->
  10. <!--{else}-->
  11. {eval $GLOBALS[aimgs][$attach[pid]][] = $attach[aid];}{eval $widthcode = attachwidth($attach[width]);}
  12. <!--{if $attachrefcheck || $hideurl}-->
  13. <img src="images/common/none.gif" file="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&fid=$fid&noupdate=yes&sid=$sidauth" $widthcode id="aimg_$attach[aid]" alt="$attach[filename]" onerror="javascript:errpic(this)" />
  14. <!--{else}-->
  15. <img src="images/common/none.gif" file="$attach[url]/$attach[attachment]" id="aimg_$attach[aid]" $widthcode alt="$attach[filename]" onerror="javascript:errpic(this)" />
  16. <!--{/if}-->
  17. <!--{/if}-->
复制代码
接下继续查找:
  1. <!--{if $thumbstatus && $attach[thumb]}-->
  2. <!--{if $attachrefcheck || $hideurl}-->
  3. <a href="javascript:;"><img onclick="zoom(this, attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&noupdate=yes&nothumb=yes&sid=$sidauth)" src="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&sid=$sidauth" border="0" id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" /></a>
  4. <!--{else}-->
  5. <a href="javascript:;"><img onclick="zoom(this, $attach[url]/$attach[attachment])" src="$attach[url]/$attach[attachment].thumb.jpg" border="0" id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" /></a>
  6. <!--{/if}-->
  7. <!--{else}-->
  8. {eval $GLOBALS[aimgs][$attach[pid]][] = $attach[aid];}{eval $widthcode = attachwidth($attach[width]);}
  9. <!--{if $attachrefcheck || $hideurl}-->
  10. <img src="images/common/none.gif" file="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&noupdate=yes&sid=$sidauth" $widthcode id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" alt="$attach[filename]"/>
  11. <!--{else}-->
  12. <img src="images/common/none.gif" file="$attach[url]/$attach[attachment]" $widthcode id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" alt="$attach[filename]" />
  13. <!--{/if}-->
  14. <!--{/if}-->
复制代码
替换为:
  1. <!--{if $thumbstatus && $attach[thumb]}-->
  2. <!--{if $attachrefcheck || $hideurl}-->
  3. <a href="javascript:;"><img onclick="zoom(this, attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&noupdate=yes&nothumb=yes&sid=$sidauth)" src="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&sid=$sidauth"onerror="javascript:errpic(this)" border="0" id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" /></a>
  4. <!--{else}-->
  5. <a href="javascript:;"><img onclick="zoom(this, $attach[url]/$attach[attachment])" src="$attach[url]/$attach[attachment].thumb.jpg"onerror="javascript:errpic(this)" border="0" id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" /></a>
  6. <!--{/if}-->
  7. <!--{else}-->
  8. {eval $GLOBALS[aimgs][$attach[pid]][] = $attach[aid];}{eval $widthcode = attachwidth($attach[width]);}
  9. <!--{if $attachrefcheck || $hideurl}-->
  10. <img src="images/common/none.gif" file="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp&noupdate=yes&sid=$sidauth" $widthcode id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" alt="$attach[filename]"onerror="javascript:errpic(this)" />
  11. <!--{else}-->
  12. <img src="images/common/none.gif" file="$attach[url]/$attach[attachment]" $widthcode id="aimg_$attach[aid]" onmouseover="showMenu(this.id, false, 2)" alt="$attach[filename]"onerror="javascript:errpic(this)" />
  13. <!--{/if}-->
  14. <!--{/if}-->
复制代码
第二步:打开templates/header.htm文件。 查找:
  1. <script type="text/javascript" src="include/js/common.js?{VERHASH}"></script>
复制代码
在下面加:
  1. <script>
  2. function errpic(thepic){
  3. thepic.src="images/nopic.gif"
  4. }
  5. </script>
复制代码
第三步:打开include/discuzcode.func.php文件。 查找:
  1. "bbcodeurl(\\\\1, <img src=\\"%s\\" onload=\\"thumbImg(this)\\" alt=\\"\\" />)",
复制代码
替换为
  1. "bbcodeurl(\\\\1, <img src=\\"%s\\" onload=\\"thumbImg(this)\\" alt=\\"\\" onerror=\\"javascript:errpic(this)\\"/>)",
复制代码
第四步:把图片传到images目录common文件夹,后台更新缓存。结束

common.rar

7 KB, 下载次数: 1, 下载积分: 体力 -1 点

出售国内或美国高性能虚拟空间,高速VPS以及服务器! 同时承接各种类型的网站制作,网站维护,支付宝交易安全放心!    联系QQ:6102031
懒得打字嘛,点击右侧快捷回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

网站公告上一条 /2 下一条

GMT+8, 2024-5-20 00:31 , Processed in 0.109375 second(s), 28 queries , Gzip On.

© 2006-2022 Powered by Discuz! X3.4

快速回复 返回顶部 返回列表