| 1.source\function\function_forum.php 搜索:
 
 
 复制代码function getthreadcover($tid, $cover = 0, $getfilename = 0) {
        global $_G;
        if(empty($tid)) {
                return '';
        }
        $coverpath = '';
        $covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';
        if($getfilename) {
                return $covername;
        }
        if($cover) {
                $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
        }
        return $coverpath;
}
改成:
 
 复制代码function getthreadcover($tid, $cover = 0, $getfilename = 0) {
        global $_G;
        if(empty($tid)) {
                return '';
        }
        $coverpath = '';
        //$covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';
        $covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.'.$ext;
        if($getfilename) {
                return $covername;
        }
        if($cover) {
                $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
        }
        return $coverpath;
}
 2.source\function\function_post.php
 搜索:
 
 复制代码$basedir = !$_G['setting']['attachdir'] ? (DISCUZ_ROOT.'./data/attachment/') : $_G['setting']['attachdir'];
                $coverdir = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/';
                dmkdir($basedir.'./forum/'.$coverdir);
 下面加入
 
 复制代码 if(fileext($picsource) == 'gif') { // 判断是否是gif
            copy($picsource, 'data/attachment/forum/'.$coverdir.$tid.'.gif'); // 直接把gif图片复制到缩略图目录,并改名为tid.gif
            $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);  
            if($imgurl && empty($cover)) {
                $cover = 1;
            }
 |