Esempio n. 1
0
 if (is_file($oldfile)) {
     if ($old_avatar > 0 && isset($jieqi_image_type[$old_avatar])) {
         $old_imagefile = $basedir . '/' . $jieqiUsers->getVar('uid', 'n') . $jieqi_image_type[$old_avatar];
         jieqi_delfile($old_imagefile);
     }
     $posary = explode(',', $_REQUEST['cut_pos']);
     foreach ($posary as $k => $v) {
         $posary[$k] = intval($v);
     }
     include_once JIEQI_ROOT_PATH . '/lib/image/imageresize.php';
     $imgresize = new ImageResize();
     $imgresize->load($oldfile);
     if ($posary[2] > 0 && $posary[3] > 0) {
         $imgresize->resize($posary[2], $posary[3]);
     }
     $imgresize->cut($jieqiConfigs['system']['avatardw'], $jieqiConfigs['system']['avatardh'], intval($posary[0]), intval($posary[1]));
     $tmp_save = $uptmp . '/' . $_SESSION['jieqiUserId'] . $jieqiConfigs['system']['avatardt'];
     $imgresize->save($tmp_save);
     jieqi_copyfile($tmp_save, $newfile, 0777, true);
     $imgresize->resize($jieqiConfigs['system']['avatarsw'], $jieqiConfigs['system']['avatarsh']);
     $tmp_save = $uptmp . '/' . $_SESSION['jieqiUserId'] . 's' . $jieqiConfigs['system']['avatardt'];
     $imgresize->save($tmp_save);
     jieqi_copyfile($tmp_save, $smallfile, 0777, true);
     $imgresize->resize($jieqiConfigs['system']['avatariw'], $jieqiConfigs['system']['avatarih']);
     $tmp_save = $uptmp . '/' . $_SESSION['jieqiUserId'] . 'i' . $jieqiConfigs['system']['avatardt'];
     $imgresize->save($tmp_save, true);
     jieqi_copyfile($tmp_save, $iconfile, 0777, true);
     jieqi_delfile($oldfile);
     $image_type = 0;
     $image_postfix = $jieqiConfigs['system']['avatardt'];
     foreach ($jieqi_image_type as $k => $v) {
Esempio n. 2
0
        updatetable(table('members'), $setsqlarr, $wheresql) ? exit($setsqlarr['avatars']) : showmsg('保存失败!', 1);
    } else {
        showmsg('保存失败!', 1);
    }
} elseif ($act == 'avatars_save') {
    require_once QISHI_ROOT_PATH . 'include/cut_upload.php';
    require_once QISHI_ROOT_PATH . 'include/imageresize.class.php';
    $imgresize = new ImageResize();
    $userinfomation = get_user_info($_SESSION['uid']);
    if ($userinfomation['avatars']) {
        $up_dir_original = "../../data/avatar/original/";
        $up_dir_100 = "../../data/avatar/100/";
        $up_dir_48 = "../../data/avatar/48/";
        $up_dir_thumb = "../../data/avatar/thumb/";
        $imgresize->load($up_dir_thumb . $userinfomation['avatars']);
        $imgresize->cut(intval($_POST['w']), intval($_POST['h']), intval($_POST['x']), intval($_POST['y']));
        $imgresize->save($up_dir_thumb . $userinfomation['avatars']);
        makethumb($up_dir_thumb . $userinfomation['avatars'], $up_dir_100 . date("Y/m/d/"), 100, 100);
        makethumb($up_dir_thumb . $userinfomation['avatars'], $up_dir_48 . date("Y/m/d/"), 48, 48);
        @unlink($up_dir_original . $userinfomation['avatars']);
        @unlink($up_dir_thumb . $userinfomation['avatars']);
        $wheresql = " uid='" . $_SESSION['uid'] . "'";
        write_memberslog($_SESSION['uid'], 2, 1006, $_SESSION['username'], "修改了个人头像");
        showmsg('保存成功!', 2);
    } else {
        showmsg('请上传图片!', 1);
    }
} elseif ($act == 'password_edit') {
    $uid = intval($_SESSION['uid']);
    $smarty->assign('total', $db->get_total("SELECT COUNT(*) AS num FROM " . table('pms') . " WHERE (msgfromuid='{$uid}' OR msgtouid='{$uid}') AND `new`='1'"));
    $smarty->assign('title', '修改密码 - 个人会员中心 - ' . $_CFG['site_name']);
Esempio n. 3
0
    if (empty($teachers)) {
        showmsg("请先填写讲师基本信息!", 0);
    }
    require_once QISHI_ROOT_PATH . 'include/imageresize.class.php';
    $imgresize = new ImageResize();
    $photo_dir = QISHI_ROOT_PATH . substr($_CFG['teacher_photo_dir'], strlen($_CFG['site_dir']));
    $photo_thumb_dir = QISHI_ROOT_PATH . substr($_CFG['teacher_photo_dir_thumb'], strlen($_CFG['site_dir']));
    $imgresize->load($photo_dir . $teachers['photo_img']);
    $posary = explode(',', $_POST['cut_pos']);
    foreach ($posary as $k => $v) {
        $posary[$k] = intval($v);
    }
    if ($posary[2] > 0 && $posary[3] > 0) {
        $imgresize->resize($posary[2], $posary[3]);
    }
    $imgresize->cut(120, 150, intval($posary[0]), intval($posary[1]));
    $imgresize->save($photo_thumb_dir . $teachers['photo_img']);
    header('Location: ?act=photo_cutting&show=ok&pid=' . $_REQUEST['pid']);
} elseif ($act == 'edit_photo_display') {
    header('Location: ?act=teachers_show&id=' . intval($_REQUEST['pid']));
} elseif ($act == 'teachers_show') {
    $teachers = get_teachers_one(intval($_GET['id']), $_SESSION['uid']);
    if (empty($teachers)) {
        showmsg("参数错误!", 1);
    }
    $smarty->assign('title', '修改讲师资料 - 培训会员中心 - ' . $_CFG['site_name']);
    $smarty->assign('teachers', $teachers);
    $smarty->display('member_train/train_teachersshow.htm');
} elseif ($act == 'del_teachers') {
    $yid = !empty($_POST['y_id']) ? $_POST['y_id'] : $_GET['y_id'];
    if ($n = del_teachers($yid, $_SESSION['uid'])) {