用组图插件上传的图片,也能在首页展现了!
关于组图插件的安装,请访问https://discuz.dismall.com/thread-862372-1-1.html
关于组图插件的详细介绍,请访问:http://z.xkoo.com
您只需改动一个文件,就能做到在首页调用组图上传的图片。
注:这里指的首页四格是由7ree提供的插件。如果您用的是其它版本的首页四格,请与我们联系。
下面是针对dz6.1和dz6.0的修改方法。
改动pic.php
在- $data['expiration'] = $cachelife + time();
复制代码 之前加入- if($_DCACHE['settings']['qihoo_image']['senable']) {
- require_once './include/qcomic.inc.php';
- $qcomic_data = array();
- $gids = '';
- $query = $db->query("SELECT qi.phid, t.tid, t.fid, t.subject FROM {$tablepre}qihooimages qi LEFT JOIN {$tablepre}threads t ON t.tid=qi.tid WHERE qi.phid<>'-1' GROUP BY qi.tid ORDER BY qi.tid DESC LIMIT $shownums");
- while ($pic = $db->fetch_array($query)) {
- $qcomic_data[$pic[phid]]['showpicpics'] = '';
- $qcomic_data[$pic[phid]]['showpiclinks'] = "viewthread.php?tid=$pic[tid]";
- $qcomic_data[$pic[phid]]['showpictexts'] = str_replace('\'', ' ',$pic['subject']);
- $gids.= ','.$pic[phid];
- }
- if ($gids) {
- $ret = qcomic_fopen("http://comic.qihoo.com/discuz/info_get_by_gid.php?sid=".$_DCACHE['settings']['qihoo_image']['sid']."&code=".urlencode(qcomic_authcode("spassword=".$_DCACHE['settings']['qihoo_image']['spassword'], '', $_DCACHE['settings']['qihoo_image']['skey']))."&gids=".urlencode(substr($gids, 1)), 10000, '', '', TRUE, '', 20, TRUE);
- $ret = unserialize($ret);
- foreach($qcomic_data as $phid=>$val) {
- if (isset($ret['info'][$phid])) {
- $data['pic'][$phid] = $qcomic_data[$phid];
- $data['pic'][$phid]['showpicpics'] = $ret['info'][$phid]['iurl'];
- }
- }
- function qcomic_compare_imgpos($a, $b) {
- $aid = substr($a['showpiclinks'], 19);
- $bid = substr($b['showpiclinks'], 19);
- if ($aid==$bid) return 0;
- return ($aid < $bid) ? 1 : -1;
- }
- usort($data['pic'], "qcomic_compare_imgpos");
- }
- }
复制代码 把- if(is_readable($pic[$i]['showpicpics'])) {
复制代码 替换为- if(is_readable($pic[$i]['showpicpics']) || substr($pic[$i]['showpicpics'],0,4)=='http') {
复制代码 |
改动pic.php
在- $data['expiration'] = $cachelife + time();
复制代码 之前,加如下代码- if($_DCACHE['settings']['qihoo_image']['senable']) {
- require_once './include/qcomic.inc.php';
- $qcomic_data = array();
- $gids = '';
- $query = $db->query("SELECT qi.phid, t.tid, t.fid, t.subject FROM {$tablepre}qihooimages qi LEFT JOIN {$tablepre}threads t ON t.tid=qi.tid WHERE qi.phid<>'-1' GROUP BY qi.tid ORDER BY qi.tid DESC LIMIT $shownums");
- while ($pic = $db->fetch_array($query)) {
- $qcomic_data[$pic[phid]]['showpicpics'] = '';
- $qcomic_data[$pic[phid]]['showpiclinks'] = "viewthread.php?tid=$pic[tid]";
- $qcomic_data[$pic[phid]]['showpictexts'] = str_replace('\'', ' ',$pic['subject']);
- $gids.= ','.$pic[phid];
- }
- if ($gids) {
- $ret = qcomic_fopen("http://comic.qihoo.com/discuz/info_get_by_gid.php?sid=".$_DCACHE['settings']['qihoo_image']['sid']."&code=".urlencode(authcode("spassword=".$_DCACHE['settings']['qihoo_image']['spassword'], '', $_DCACHE['settings']['qihoo_image']['skey']))."&gids=".urlencode(substr($gids, 1)), 10000, '', '', TRUE, '', 20, TRUE);
- $ret = unserialize($ret);
- foreach($qcomic_data as $phid=>$val) {
- if (isset($ret['info'][$phid])) {
- $data['pic'][$phid] = $qcomic_data[$phid];
- $data['pic'][$phid]['showpicpics'] = $ret['info'][$phid]['iurl'];
- }
- }
- function qcomic_compare_imgpos($a, $b) {
- $aid = substr($a['showpiclinks'], 19);
- $bid = substr($b['showpiclinks'], 19);
- if ($aid==$bid) return 0;
- return ($aid < $bid) ? 1 : -1;
- }
- usort($data['pic'], "qcomic_compare_imgpos");
- }
- }
复制代码 把- if(is_readable($pic[$i]['showpicpics'])) {
复制代码 替换为- if(is_readable($pic[$i]['showpicpics']) || substr($pic[$i]['showpicpics'],0,4)=='http') {
复制代码 |
祝调用成功
[ 本帖最后由 todidot 于 2008-5-14 11:04 编辑 ] |