Discuz X1.5群组缩略图大小修改

打开\source\function\function_group.php

    if($data['status'] == 3) {
        $imgwh = array('icon' => array('48', '48'), 'banner' => array('720', '168'));
        require_once libfile('class/image');
        $img = new image;
        $img->Thumb($upload->attach['target'], './'.$uploadtype.'/'.$upload->attach['attachment'], $imgwh[$type][0], $imgwh[$type][1], 'fixwr');
    }
    return $upload->attach['attachment'];
}

可增加一个字段:

    if($data['status'] == 3) {
        $imgwh = array('icon' => array('48', '48'), 'banner' => array('720', '168'), 'hkshadow' => array('91', '91'));
        require_once libfile('class/image');
        $img = new image;
        $img->Thumb($upload->attach['target'], './'.$uploadtype.'/'.$upload->attach['attachment'], $imgwh[$type][0], $imgwh[$type][1], 'fixwr');
    }
    return $upload->attach['attachment'];
}

然后打开\source\module\forum\forum_group.php

//源代码
            $iconnew = upload_icon_banner($_G['forum'], $_FILES['iconnew'], 'icon');
            $bannernew = upload_icon_banner($_G['forum'], $_FILES['bannernew'], 'banner');
            if($iconnew) {
                $iconsql .= ", icon='$iconnew'";
                $group_recommend = unserialize($_G['setting']['group_recommend']);
                if($group_recommend[$_G['fid']]) {
                    $group_recommend[$_G['fid']]['icon'] = get_groupimg($iconnew);
                    DB::query("UPDATE ".DB::table('common_setting')." SET svalue = '".serialize($group_recommend)."' WHERE skey = 'group_recommend' LIMIT 1");
                    include libfile('function/cache');
                    updatecache('setting');
                }
            }

            if($bannernew && empty($deletebanner)) {
                $iconsql .= ", banner='$bannernew'";
            } elseif($deletebanner) {
                $iconsql .= ", banner=''";
                @unlink($_G['forum']['banner']);
            }

修改后

            $iconnew = upload_icon_banner($_G['forum'], $_FILES['iconnew'], 'icon');
            $bannernew = upload_icon_banner($_G['forum'], $_FILES['bannernew'], 'banner');
            //修改原来的缩略图大小
            //2011-04-20
            $hkshadownew = upload_icon_banner($_G['forum'], $_FILES['hkshadownew'], 'hkshadow');

            if($iconnew) {
                $iconsql .= ", icon='$iconnew'";
                $group_recommend = unserialize($_G['setting']['group_recommend']);
                if($group_recommend[$_G['fid']]) {
                    $group_recommend[$_G['fid']]['icon'] = get_groupimg($iconnew);
                    DB::query("UPDATE ".DB::table('common_setting')." SET svalue = '".serialize($group_recommend)."' WHERE skey = 'group_recommend' LIMIT 1");
                    include libfile('function/cache');
                    updatecache('setting');
                }
            }

            if($bannernew && empty($deletebanner)) {
                $iconsql .= ", banner='$bannernew'";
            } elseif($deletebanner) {
                $iconsql .= ", banner=''";
                @unlink($_G['forum']['banner']);
            }

            /**
             * 新增字段
             * 2011-04-20
             */
                if($bannernew) {
                $iconsql .= ", hkshadow='$hkshadownew'";
            }

然后在\source\module\forum\forum_group.php代码里搜索

$_G['forum']['banner'] = get_groupimg($_G['forum']['banner']);

在下面增加一跳全局:

$_G['forum']['hkshadow'] = get_groupimg($_G['forum']['hkshadow']);

最后修改\template\default\group\group_manage.htm的input框的name值 和上面的代码对应,如下:

 <input type="file" id="iconnew" class="pf vm" size="25" name="hkshadownew" />

Leave a Reply

(will not be published)