discuz 个人空间主题列表图片显示-Discuz教程下载

discuz 个人空间主题列表图片显示

开通本站Svip会员,全站资源免费下
如果需要实现该呈现方式,我们需要首先了解Discuz封面图片存储原理:
discuz没有将主题列表封面路径存在数据表中,只是在pre_forum_thread表中存了一个cover标识。然后用getthreadcover 函数调取,diy调用的图片也会产生缩略图,可以设置缩略图的质量。
封面图片存储路径格式:data/attachment/forum/threadcover/43/ec/81.jpg
getthreadcover 函数:
  1.     function getthreadcover($tid, $cover = 0, $getfilename = 0) {  
  2.       global $_G;  
  3.       if(emptyempty($tid)) {  
  4.         return '';  
  5.       }  
  6.       $coverpath = '';  
  7.       $covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';  
  8.       if($getfilename) {  
  9.         return $covername;  
  10.       }  
  11.       if($cover) {  
  12.         $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;  
  13.       }  
  14.       return $coverpath;  
  15.     }  
复制代码
文件路径:/source/function/function_forum.php  
实现方法:
修改:/source/language/home/lang_template.php
添加like 喜欢或查看
修改:/template/default/home/space_thread.htm
处理封面图:
  1.     {eval   
  2.       $covername = 'threadcover/'.substr(md5($thread[tid]), 0, 2).'/'.substr(md5($thread[tid]), 2, 2).'/'.$thread[tid].'.jpg';  
  3.         
  4.       $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;  
  5.     }  
  6.     <li style="width: 227px;  left: 0px; top: 0px;float:left;">  
  7.       <div class="c cl">  
  8.       <a class="z" title="$thread[subject]" onclick="atarget(this)" href="forum.php?mod=viewthread&tid=$thread[tid]">  
  9.       <img width="203" alt="$thread[subject]" src="{eval echo $coverpath;}">  
  10.       </a>  
  11.       </div>  
  12.       <h3 class="xw0">  
  13.       <a href="forum.php?mod=viewthread&tid=$thread[tid]" onclick="atarget(this)" target="_blank" {if $thread['displayorder'] == -1}class="recy"{/if}>$thread[subject]</a>  
  14.       </h3>  
  15.       <div class="auth cl">  
  16.       <cite class="xg1 y">  
  17.       {lang like}: <em>$thread[views]</em>   {lang reply}: <a title="0回复" href="forum.php?mod=viewthread&tid=$thread[tid]">$thread[replies]</a>  
  18.       </cite>  
  19.       <a href="home.php?mod=space&uid=$thread[authorid]" target="_blank">$thread[author]</a>$thread[dateline]</div>  
  20.     </li>  
复制代码

文件下载:
附件下载 homepic.zip (2.41 KB, 下载次数: 140)

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部