无限星辰工作室-客户无限互联网动力之源

标题: Discuz!x GIF缩略图 [打印本页]

作者: crx349    时间: 2020-5-31 21:59
标题: Discuz!x GIF缩略图
1.source\function\function_forum.php
搜索:

  1. function getthreadcover($tid, $cover = 0, $getfilename = 0) {
  2.         global $_G;
  3.         if(empty($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. }
复制代码

改成:
  1. function getthreadcover($tid, $cover = 0, $getfilename = 0) {
  2.         global $_G;
  3.         if(empty($tid)) {
  4.                 return '';
  5.         }
  6.         $coverpath = '';
  7.         //$covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';
  8.         $covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.'.$ext;
  9.         if($getfilename) {
  10.                 return $covername;
  11.         }
  12.         if($cover) {
  13.                 $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
  14.         }
  15.         return $coverpath;
  16. }
复制代码


2.source\function\function_post.php
搜索:
  1. $basedir = !$_G['setting']['attachdir'] ? (DISCUZ_ROOT.'./data/attachment/') : $_G['setting']['attachdir'];
  2.                 $coverdir = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/';
  3.                 dmkdir($basedir.'./forum/'.$coverdir);
复制代码


下面加入
  1. if(fileext($picsource) == 'gif') { // 判断是否是gif
  2.             copy($picsource, 'data/attachment/forum/'.$coverdir.$tid.'.gif'); // 直接把gif图片复制到缩略图目录,并改名为tid.gif
  3.             $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);  
  4.             if($imgurl && empty($cover)) {
  5.                 $cover = 1;
  6.             }
复制代码





欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/) Powered by Discuz! X3.4